INCLUDE(FindPkgConfig)
pkg_check_modules(PKGS REQUIRED
elementary
+ glib-2.0
+ libexif
capi-appfw-application
+ capi-appfw-package-manager
app-utils
pkgmgr-info
capi-appfw-package-manager
+ storage
+ capi-content-media-content
+ capi-base-utils-i18n
+ capi-media-metadata-extractor
+ capi-content-mime-type
+ libtzplatform-config
)
IF(NOT DEFINED PACKAGE_NAME)
SET(SRCS
src/main.c
- src/utils.c
- src/view/view_base.c
- src/view/dialog_popup_view.c
+ src/view/base.c
+ src/layout/default.c
+ src/util/utils.c
+ src/util/dialog_popup.c
+ src/util/file-attr.c
+ src/util/fs-util.c
+ src/util/file-util.c
+ src/util/file-error.c
)
SET(TARGET_EDJ "${PROJECT_NAME}.edj")
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+#include <layoutmgr.h>
+#include <app_debug.h>
+
+#include "util/fs-util.h"
+
+#ifndef __AIR_MYFILES_DATA_H__
+#define __AIR_MYFILES_DATA_H__
+
+typedef struct list_data {
+ int folder_count;
+ int file_count;
+
+ Eina_List *file_list;
+ Eina_List *folder_list;
+
+ int depth;
+
+ char *path;
+} list_data_s ;
+
+struct _priv {
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *layout;
+ Evas_Object *menu_btn;
+ Evas_Object *view_btn;
+ Evas_Object *popup_win;
+ Evas_Object *popup_base;
+
+ Evas_Object *icon1;
+ Evas_Object *icon2;
+
+ layoutmgr *lmgr;
+
+ const char* selected_folder;
+ char* selected_parent_path;
+
+ int same;
+ int expanded;
+};
+
+typedef struct path_item_data {
+ int index;
+ Elm_Object_Item *item;
+
+ const char *selected_folder;
+ char *parent_path;
+ char *full_path;
+
+ int level;
+ int expanded;
+} path_item_data_s ;
+
+typedef struct item_data {
+ int index;
+ Elm_Object_Item *item;
+
+ int folder_count;
+ int file_count;
+
+ Eina_List *file_list;
+ Eina_List *folder_list;
+
+ const char *last_path;
+
+ int is_home;
+ char *selected_folder_path;
+ Eina_List *child;
+ Eina_List *child_file_size;
+ char *parent_path;
+
+ int is_empty;
+ int expanded;
+ int level;
+
+ char *name;
+ char *file_size;
+
+ fsNodeInfo *node;
+ fsFileType type;
+
+ Evas_Object *base;
+ Evas_Object *layout;
+} item_data_s;
+
+#endif /* __AIR_MYFILES_DATA_H__ */
#ifndef __AIR_MYFILES_DEFINE_H__
#define __AIR_MYFILES_DEFINE_H__
+#include "layout/default.h"
+
+/* Definitions for common */
+#define SOURCE_PROGRAM "program"
+#define SOURCE_ELM "elm"
+#define SOURCE_EDC "edc"
+
/* View ID */
#define VIEW_BASE "VIEW_BASE"
-#define VIEW_ACTION_MENU "VIEW_ACTION_MENU"
/* Layout ID */
-#define LAYOUT_MYFILES "LAYOUT_FILES"
+#define LAYOUT_MYFILES "LAYOUT_MYFILES"
/* Group for EDC */
-#define GRP_VIEW_BASE "grp.view.base"
-#define GRP_VIEW_ACTION_MENU "grp.view.action.menu"
+#define GRP_LAYOUT_BASE "grp.layout.base"
+#define GRP_VIEW_SUBMENU "grp.view.submenu"
+#define GRP_VIEW_SELECT_FOLDER "grp.view.select.folder"
#define GRP_ACTION_MENU_CONTENTS "grp.action.menu.contents"
-#define GRP_ACTION_MENU_NO_FAVORITE "grp.action.menu.no.favorite"
#define GRP_DIALOG_POPUP "grp.dialog.popup"
+#define GRP_DIALOG_POPUP_NO_TITLE "grp.dialog.popup.notitle"
+
+#define GRP_VIEW_DEFAULT "grp.view.default"
+#define GRP_VIEW_SELECT "grp.view.select"
/* Part for EDC */
+#define PART_BG "part.bg"
#define PART_TOP_TITLE "part.top.title"
+#define PART_TOP_TITLE_BG "part.top.title.bg"
#define PART_MENU "part.menu"
+#define PART_CONFIRM "part.confirm"
#define PART_SORT "part.sort"
#define PART_GENGRID "part.gengrid"
#define PART_APP_COUNT "part.app.count"
#define PART_POPUP_TITLE "title,text"
#define PART_ACTION_MENU "part.action.menu"
+#define PART_FILE_PATH "part.file.path"
+#define PART_FILE_PATH_BG "part.file.path.bg"
+#define PART_CONTENT_AREA "part.content.area"
+#define PART_CONTENT_AREA_BG "part.content.area.bg"
+#define PART_FOLDER_LIST "part.folder.list"
+#define PART_FOLDER_LIST_BG "part.folder.list.bg"
+#define PART_FILE_LIST "part.file.list"
+#define PART_FILE_LIST_BG "part.file.list.bg"
+
/* State for EDC */
#define STATE_BROWSER "is_browser"
#define STATE_NOT_BROWSER "not_browser"
/* Style */
-#define STYLE_MENU_BTN "style.menu.button"
#define STYLE_SORT_BTN "style.sort.button"
#define STYLE_OPTION_BTN "style.option.button"
#define STYLE_CTXPOPUP "style.ctxpopup"
#define STYLE_TOAST "style.toast"
/* Signal */
-#define SIG_FOCUSED "focused"
-#define SIG_UNFOCUSED "unfocused"
-#define SIG_SELECTED "selected"
-#define SIG_UNSELECTED "unselected"
-#define SIG_SOURCE_EDC "edc"
-#define SIG_FAVORITE "favorite"
-#define SIG_UNFAVORITE "unfavorite"
+#define SIGNAL_FOCUSED "elm,action,focus"
+#define SIGNAL_UNFOCUSED "elm,action,unfocus"
+#define SIGNAL_DISABLED "elm,state,disabled"
+#define SIGNAL_ITEM_SELECTED "item,selected"
+#define SIGNAL_ITEM_UNSELECTED "item,unselected"
+#define SIGNAL_NO_NOTIFICATION "signal.no_notification"
+#define SIGNAL_NOTIFICATION "signal.notification"
+#define SIGNAL_TOGGLE "elm,state,toggle"
+#define SIGNAL_UNTOGGLE "elm,state,untoggle"
+#define SIGNAL_CHILD_REMOVED "child,removed"
+#define SIGNAL_SHOW "show"
+#define SIGNAL_HIDE "hide"
+#define SIGNAL_HIDE_FINISHED "elm,action,hide,finished"
+
#define SIG_VISIBLE "visible"
#define SIG_INVISIBLE "invisible"
-#define SIG_DISABLE "elm,state,disabled"
-#define SIG_TOGGLE "toggle"
+#define SIG_UNSELECTED "unselected"
#define SIG_TIMEOUT "timeout"
-#define SIG_SHOW "show"
-#define SIG_HIDE "hide"
-#define SIG_HIDE_DONE "hide.done"
/* Signal Source */
#define SRC_MYAPPS "source.myapps"
#define FONT_TIZENSANS_LIGHT "BreezeSans:style=Light"
/* String */
-#define STR_APPS "Files"
-#define STR_MYAPPS "My Files"
-#define STR_NULL "(NULL)"
-#define STR_NO_CONTENTS "No Contents"
-#define STR_NOT_SUPPORTED "Not Supported"
-#define STR_WGT "wgt"
-#define STR_TPK "tpk"
-#define STR_OK "Ok"
-#define STR_CANCEL "Cancel"
-#define STR_MORE "More"
+#define STR_MYFILES "My Files"
+#define STR_APPSTORE "App Store"
+#define STR_RECENT "Recent"
+#define STR_A_TO_Z "A-Z"
+#define STR_Z_TO_A "Z-A"
+#define STR_SELECT_TARGET_FOLDER "Select target folder"
+#define STR_NEW_FOLDER "New Folder"
+#define STR_MENU_COPY "Copy"
+#define STR_MENU_MOVE "Move"
+#define STR_MENU_RENAME "Rename"
+#define STR_MENU_NEW_FOLDER "New folder"
+#define STR_MENU_DELETE "Delete"
+#define STR_MENU_SETTING "Setting"
+#define STR_SETTING_SHOW_HIDDEN_FILE "Show hidden files"
+#define STR_DELETE_CONFIRM "Delete?"
+#define STR_NEW_FOLDER_TITLE "New folder"
+#define STR_RENAME_TITLE "Rename"
+#define STR_NEW_FOLDER_ENTRY "Input folder name"
+#define STR_RENAME_ENTRY "Input folder/file name"
/* Count */
-#define MENU_COUNT 1
+#define MENU_COUNT 2
#define SORT_COUNT 3
#define ACTION_MENU_COUNT 2
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_MYFILES_LAYOUT_H__
+#define __AIR_MYFILES_LAYOUT_H__
+
+layout_class *layout_default_get_lclass(void);
+layout_class *layout_select_get_lclass(void);
+
+#endif /* __AIR_MYFILES_LAYOUT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_MYFILES_LAYOUT_DEFAULT_H__
+#define __AIR_MYFILES_LAYOUT_DEFAULT_H__
+
+/* layout */
+#define LAYOUT_DEFAULT "LAYOUT_DEFAULT"
+
+#endif /* __AIR_MYFILES_LAYOUT_DEFAULT_H__ */
DIALOG_POPUP_TYPE_YES_OR_CANCEL = 1,
DIALOG_POPUP_TYPE_INPUT_NAME = 2,
DIALOG_POPUP_TYPE_CONFIGURATION = 3,
+ DIALOG_POPUP_TYPE_SUBMENU = 4,
} dialog_popup_type_e;
typedef struct _dialog_popup_info_t {
char *content;
char *button_1_text;
char *button_2_text;
+ void *data;
/* Button event handler is required */
} dialog_popup_info_t;
/* Functions */
-Evas_Object *dialog_popup_create(Evas_Object *win, dialog_popup_info_t *dialog_popup_info);
+Evas_Object *dialog_popup_create(/*Evas_Object *win, */dialog_popup_info_t *dialog_popup_info);
#endif /* __AIR_MYFILES_DIALOG_POPUP_VIEW_H__ */
--- /dev/null
+/*
+* Copyright 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef __MF_FILE_UTIL_H__
+#define __MF_FILE_UTIL_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <Elementary.h>
+
+const char* mf_file_get(const char path[]);
+char* mf_dir_get(const char path[]);
+int mf_file_exists(const char *path);
+Eina_Bool mf_is_dir(const char *path);
+int mf_is_dir_empty(const char *path);
+int mf_mkdir(const char *dir);
+int mf_mkpath(const char *path);
+char *mf_strip_ext(const char *path);
+int mf_file_unlink(const char *filename);
+int mf_file_size(const char *filename);
+int mf_file_rmdir(const char *filename);
+Eina_List *mf_file_ls(const char *dir);
+int mf_file_recursive_rm(const char *dir);
+int mf_file_cp(const char *src, const char *dst);
+int mf_file_mv(const char *src, const char *dst);
+int mf_remove(const char *filename);
+
+#endif /*__mf_FILE_UTIL_H__*/
--- /dev/null
+/*
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef __MF_ERROR_H_DEF__
+#define __MF_ERROR_H_DEF__
+
+#include <stdio.h>
+
+#define MF_ERROR_MASKL16 0xFFFF
+
+#define MF_ERROR_SET(X) (X & MF_ERROR_MASKL16)
+
+#define MID_CONTENTS_MGR_ERROR 0
+
+#define MYFILE_ERR_NONE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x00)) /**< No error */
+
+#define MYFILE_ERR_SRC_ARG_INVALID (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x01)) /**< invalid src argument */
+#define MYFILE_ERR_DST_ARG_INVALID (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x02)) /**< invalid dst argument */
+#define MYFILE_ERR_FILE_DELETE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x03)) /**< exception of delete file */
+#define MYFILE_ERR_FILE_MOVE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x04)) /**< exception of move file */
+#define MYFILE_ERR_FILE_COPY_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x05)) /**< exception of copy file */
+#define MYFILE_ERR_FILE_WRITE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x06)) /**< exception of read file */
+#define MYFILE_ERR_RENAME_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x07)) /**< exception of rename file */
+#define MYFILE_ERR_FILE_NOT_FOUND (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x08)) /**< exception of file doesn't exist*/
+#define MYFILE_ERR_DIR_OPEN_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x09)) /**< exception of dir open*/
+#define MYFILE_ERR_DIR_CREATE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0a)) /**< exception of create dir */
+
+/*11-20*/
+#define MYFILE_ERR_DIR_DELETE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0b)) /**< exception of delete dir */
+#define MYFILE_ERR_FILE_OPEN_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0c)) /**< exception of rename dir */
+#define MYFILE_ERR_DIR_COPY_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0d)) /**< exception of copy dir */
+#define MYFILE_ERR_DIR_MOVE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0e)) /**< exception of move dir */
+#define MYFILE_ERR_DIR_FULL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0f)) /**< exception of dir full */
+#define MYFILE_ERR_DIR_TOO_DEEP (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x10)) /**< exception of too deep dir */
+#define MYFILE_ERR_DIR_NOT_FOUND (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x11)) /**< exception of dir doesn't exist*/
+#define MYFILE_ERR_INVALID_DIR_NAME (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x12)) /**< exception of invalid dir name */
+#define MYFILE_ERR_INVALID_DIR_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x13)) /**< exception of invalid dir path */
+#define MYFILE_ERR_INVALID_FILE_NAME (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x14)) /**< exception of invalid file name */
+
+/*21-30*/
+#define MYFILE_ERR_INVALID_FILE_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x15)) /**< exception of invalid file path */
+#define MYFILE_ERR_GET_MEMORY_STATUS_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x16)) /**< exception of statfs */
+#define MYFILE_ERR_DUPLICATED_NAME (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x17)) /**< exception of duplicated dir name*/
+#define MYFILE_ERR_SYSTEM_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x18)) /**< exception of operating on system dir.*/
+#define MYFILE_ERR_DIR_RECUR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x19)) /**< exception of copy/move a dir to its child */
+#define MYFILE_ERR_ALLOCATE_MEMORY_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1a)) /**< exception of memory allocation */
+#define MYFILE_ERR_OUT_OF_RANGE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1b))
+#define MYFILE_ERR_INVALID_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1c)) /**< invalid path string */
+#define MYFILE_ERR_ROOT_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1d)) /**< root path */
+#define MYFILE_ERR_DCM_ENGINE_APPEND (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1e)) /**< fail to append dcm data */
+
+/*31-40*/
+#define MYFILE_ERR_NOT_MMF_FILE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1f)) /**< isn't mmf file */
+#define MYFILE_ERR_SMAF_PERMISSION_DENY (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x20)) /**< smaf lock prohibits copy/move from mmc to phone */
+#define MYFILE_ERR_COPY_TO_SRC_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x22)) /**< can't copy dir to source place*/
+#define MYFILE_ERR_COPY_ROOT_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x23)) /**< can't copy root dir*/
+#define MYFILE_ERR_COPY_TO_SRC_FILE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x24)) /**< can't copy file to source place*/
+#define MYFILE_ERR_MOVE_TO_SRC_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x25)) /**< can't move dir to source place */
+#define MYFILE_ERR_MOVE_ROOT_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x26)) /**< can't move root dir */
+#define MYFILE_ERR_MOVE_TO_SRC_FILE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x27)) /**< can't move file to source place*/
+#define MYFILE_ERR_MOVE_FILE_USING (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x28)) /**< can't move the file is being used*/
+
+/*41-50*/
+#define MYFILE_ERR_DELETE_ROOT_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x29)) /**< can't delete root dir */
+#define MYFILE_ERR_DELETE_SYSTEM_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2a)) /**< can't delete system dir */
+#define MYFILE_ERR_RENAME_ROOT_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2b)) /**< can't rename root dir */
+#define MYFILE_ERR_RENAME_SYSTEM_DIR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2c)) /**< can't rename system dir */
+#define MYFILE_ERR_EXCEED_MAX_LENGTH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2d)) /**< length of file/dir path exceeds maximum length*/
+#define MYFILE_ERR_LOW_MEMORY (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2e)) /**< low memory*/
+#define MYFILE_ERR_UNKNOWN_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x2f)) /**< unknow error*/
+#define MYFILE_ERR_WRONG_FILE_TYPE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x30)) /**< wrong file type */
+#define MYFILE_ERR_FILE_IS_BEING_USED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x31)) /**< file is being used */
+#define MYFILE_ERR_SRC_NOT_EXIST (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x32)) /**< source not found */
+
+/*51-60*/
+#define MYFILE_ERR_DST_NOT_EXIST (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x33)) /**< destination not found */
+#define MYFILE_ERR_CREATE_TEMP_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x34)) /**< create temp file failed */
+#define MYFILE_ERR_GET_LOGIC_PATH_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x35)) /**< get logical path failed */
+#define MYFILE_ERR_STORAGE_TYPE_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x36)) /**< storage type error */
+#define MYFILE_ERR_EXT_GET_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x37)) /**< get ext type failed */
+#define MYFILE_ERR_GET_PARENT_PATH_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x38)) /**< get parent path failed */
+#define MYFILE_ERR_GET_STAT_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x39)) /**< get stat failed */
+#define MYFILE_ERR_GENERATE_NAME_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3a)) /**< generate name failed */
+#define MYFILE_ERR_GET_CATEGORY_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3b)) /**< get file category failed */
+#define MYFILE_ERR_GET_STORAGE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3c)) /**< get storage value failed */
+
+/*61-70*/
+#define MYFILE_ERR_SETTING_RESET_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3d)) /**< setting item reset failed */
+#define MYFILE_ERR_DIR_CLEAR_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3e)) /**< dir not clearly deleted */
+#define MYFILE_ERR_SETTING_DELETE_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x3f)) /**< delete setting item failed */
+#define MYFILE_ERR_GET_THUMBNAIL_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x40)) /**< get file thumbnail failed */
+#define MYFILE_ERR_CANCEL_PRESSED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x41)) /**< cancel pressed while copy/move */
+#define MYFILE_ERR_ACCESS_MODE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x42)) /**< access mode not satisfied */
+#define MYFILE_ERR_FILE_READ_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x43)) /**< exception of read file */
+#define MYFILE_ERR_INVALID_ARG (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x44)) /**< argument of function is not valid */
+#define MYFILE_ERR_NO_FREE_SPACE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x45)) /**< get free space failed */
+#define MYFILE_ERR_GET_NAVI_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x46)) /**< get navigation bar failed */
+
+/*71-80*/
+#define MYFILE_ERR_STORAGE_INUSE_REMOVED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x47)) /**< get navigation bar failed */
+#define MYFILE_ERR_STORAGE_GET_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x48)) /**< get STORAGE value failed */
+#define MYFILE_ERR_PERMISSION_DENY (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x49))
+#define MYFILE_ERR_FAULT (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x4a))
+#define MYFILE_ERR_READ_ONLY (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x4b))
+
+int mf_error_erron_to_mferror(int err_no);
+
+#define mf_error(fmt, args...) do { \
+ printf("[MYFILE][E][%40s:%4d] "fmt"\n", __func__, __LINE__, ##args); \
+ MF_LOG_RECORD(fmt, ##args); \
+ } while (0)
+
+#endif /*__MF_ERROR_H_DEF__*/
--- /dev/null
+/*
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef _MYFILE_FILESYSTEM_UTIL_H_
+#define _MYFILE_FILESYSTEM_UTIL_H_
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <linux/fs.h>
+#include <utils_i18n.h>
+#include <Eina.h>
+#include <Elementary.h>
+#include <storage.h>
+#include <media_content.h>
+
+#define SAFE_FREE_CHAR(x) do {\
+ if ((x) != NULL) {\
+ free(x); \
+ x = NULL;\
+ } \
+ } while (0)
+
+#define SAFE_FREE_GSTRING(x) do {\
+ if ((x) != NULL) {\
+ g_string_free(x, TRUE); \
+ x = NULL;\
+ } \
+ } while (0)
+
+#define CHAR_CHECK_NULL_GOTO(arg, dest) do {\
+ if ((arg) == NULL) {\
+ goto dest;\
+ } \
+ } while (0)
+
+#define GSTRING_CHECK_NULL_GOTO(arg, dest) do {\
+ if ((arg) == NULL || (arg->str) == NULL) {\
+ goto dest;\
+ } \
+ } while (0)
+
+#define SAFE_TIMER_DEL(x) do {\
+ if ((x) != NULL) {\
+ ecore_timer_del(x); \
+ x = NULL;\
+ } \
+ } while (0)
+
+#define SAFE_DEL_NAVI_ITEM(x) do {\
+ if ((*x) != NULL) {\
+ elm_object_item_del(*x); \
+ (*x) = NULL;\
+ } \
+ } while (0)
+
+#define SAFE_DEL_ECORE_TIMER(timer) do { \
+ if (timer) { \
+ ecore_timer_del(timer);\
+ timer = NULL; \
+ } \
+ } while (0)
+
+#define SAFE_FREE_OBJ(x) do {\
+ if ((x) != NULL) {\
+ evas_object_del(x); \
+ x = NULL;\
+ } \
+ } while (0)
+
+#define SAFE_STRCPY(dest, src) \
+ do { if (!dest || !src)break;\
+ strncpy(dest , src, sizeof(dest)-1);\
+ dest[sizeof(dest)-1] = 0; } while (0)
+
+#define mf_ecore_idler_del(idler) do { \
+ if (idler) { \
+ ecore_idler_del(idler);\
+ idler = NULL; \
+ } \
+ } while (0)
+
+#define SAFE_FREE_ECORE_EVENT(event) do { \
+ if (event) { \
+ ecore_event_handler_del(event);\
+ event = NULL; \
+ } \
+ } while (0)
+
+#define mf_genlist_item_class_free(x) do { \
+ if (x) { \
+ elm_genlist_item_class_free(x);\
+ x = NULL; \
+ } \
+ } while (0)
+
+int mf_file_attr_get_parent_path(const char *path, char **parent_path);
+
+static inline char *Get_Root_Path(int storage_id)
+{
+ char *path = NULL;
+ storage_get_root_directory(storage_id, &path) ;
+ return path;
+}
+
+static inline char *Get_Parent_Path(int storage_id)
+{
+ char *path = NULL;
+ char *storage_path = NULL;
+ storage_get_root_directory(storage_id, &path);
+ if (path) {
+ mf_file_attr_get_parent_path(path, &storage_path);
+ free(path);
+ }
+ return storage_path;
+}
+
+
+/* File system related value definition */
+#define MYFILE_FILE_NAME_CHAR_COUNT_MAX 50
+#define MYFILE_FILE_NAME_LEN_MAX 255 /* use g_utf8_strlen to check length*/
+#define MYFILE_FILE_PATH_LEN_MAX 4096 /* use g_utf8_strlen to check length*/
+#define MYFILE_REPORT_SIZE 16384
+
+#define MYFILE_FOLDER_SIZE 0;
+
+/* File system related String definition */
+#define PHONE_FOLDER Get_Root_Path(STORAGE_TYPE_INTERNAL)
+#define MEMORY_FOLDER Get_Root_Path(STORAGE_TYPE_EXTERNAL)
+#define PHONE_PARENT Get_Parent_Path(STORAGE_TYPE_INTERNAL)
+#define STORAGE_PARENT Get_Parent_Path(STORAGE_TYPE_EXTERNAL)
+#define PHONE_NAME "content"
+#define MMC_NAME "2F72-0D21"
+
+#define MYFILE_NAME_PATTERN "[\\<>:;*\"|?/]"
+
+/* File system define default folder */
+#define DEFAULT_FOLDER_CAMERA_SHOTS "Camera shots"
+#define DEFAULT_FOLDER_DOWNLOADS "Downloads"
+#define DEFAULT_FOLDER_IMAGE "Images"
+#define DEFAULT_FOLDER_VIDEO "Videos"
+#define DEFAULT_FOLDER_MUSIC "Music"
+
+typedef enum _SORT_OPTION fsSortOption;
+enum _SORT_OPTION {
+ MYFILE_SORT_BY_NONE = 0, /**< Sort by default */
+ MYFILE_SORT_BY_NAME_A2Z, /**< Sort by file name ascending */
+ MYFILE_SORT_BY_SIZE_S2L, /**< Sort by file size ascending */
+ MYFILE_SORT_BY_DATE_O2R, /**< Sort by file date ascending */
+ MYFILE_SORT_BY_TYPE_A2Z, /**< Sort by file type ascending */
+ MYFILE_SORT_BY_NAME_Z2A, /**< Sort by file name descending */
+ MYFILE_SORT_BY_SIZE_L2S, /**< Sort by file size descending */
+ MYFILE_SORT_BY_DATE_R2O, /**< Sort by file date descending */
+ MYFILE_SORT_BY_TYPE_Z2A, /**< Sort by file type descending */
+ MYFILE_SORT_BY_MAX
+};
+
+typedef enum _FILE_TYPE fsFileType;
+enum _FILE_TYPE {
+ FILE_TYPE_NONE = 0,
+ FILE_TYPE_DIR, /**< Folder category */
+ FILE_TYPE_FILE, /**< File category */
+ FILE_TYPE_IMAGE, /**< Image category */
+ FILE_TYPE_VIDEO, /**< Video category */
+ FILE_TYPE_MUSIC, /**< Music category */
+ FILE_TYPE_SOUND, /**< Sound category */
+ FILE_TYPE_PDF, /**< Pdf category */
+ FILE_TYPE_DOC, /**< Word category */
+ FILE_TYPE_PPT, /**< Powerpoint category */
+ FILE_TYPE_EXCEL, /**< Excel category */
+ FILE_TYPE_VOICE, /**< Voice category */
+ FILE_TYPE_HTML, /**< Html category */
+ FILE_TYPE_FLASH, /**< Flash category */
+ FILE_TYPE_GAME, /**< Game category */
+ FILE_TYPE_APP, /**< Application category */
+ FILE_TYPE_THEME, /**< Theme category */
+ FILE_TYPE_TXT, /**< Txt category */
+ FILE_TYPE_VCONTACT, /**< Vcontact category */
+ FILE_TYPE_VCALENDAR, /**< Vcalendar category */
+ FILE_TYPE_VNOTE, /**< Vnote category */
+ FILE_TYPE_VBOOKMARK, /**< Vbookmark category */
+ FILE_TYPE_VIDEO_PROJECT, /**< Video editor project category */
+ FILE_TYPE_RADIO_RECORDED, /**< radio recorded clips category */
+ FILE_TYPE_MOVIE_MAKER, /**< Movie maker project category */
+ FILE_TYPE_SVG, /**< Svg category */
+ FILE_TYPE_RSS, /**< Rss reader file, *.opml */
+ FILE_TYPE_CERTIFICATION, /**< certification file, *.pem */
+ FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */
+ FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */
+ FILE_TYPE_TPK, /**< *.tpk>*/
+ FILE_TYPE_SNB, /**<*.snb> */
+ FILE_TYPE_GUL, /**<*.gul> */
+ FILE_TYPE_HWP, /**<*.hwp> */
+ FILE_TYPE_ETC, /**< Other files category */
+ FILE_TYPE_TASK,
+ FILE_TYPE_EML,
+ FILE_TYPE_CSV,
+ FILE_TYPE_SPD,
+ FILE_TYPE_MAX
+};
+
+typedef enum _STORAGE MF_STORAGE;
+
+enum _STORAGE {
+ MYFILE_NONE = 0x00,
+ MYFILE_PHONE = 0x01,
+ MYFILE_MMC = 0x02,
+ MYFILE_MAX = 0xFF
+};
+
+
+typedef enum _SIZE_TYPE MF_SIZE_TYPE;
+enum _SIZE_TYPE {
+ SIZE_BYTE = 0,
+ SIZE_KB,
+ SIZE_MB,
+ SIZE_GB
+};
+
+typedef enum __MF_SORT_BY_PRIORITY_SEQUENCE MF_SORT_BY_PRIORITY_SEQUENCE;
+enum __MF_SORT_BY_PRIORITY_SEQUENCE {
+ MF_SORT_BY_PRIORITY_TYPE_A2Z,
+ MF_SORT_BY_PRIORITY_TYPE_Z2A,
+ MF_SORT_BY_PRIORITY_DATE_O2R,
+ MF_SORT_BY_PRIORITY_DATE_R2O,
+ MF_SORT_BY_PRIORITY_SIZE_S2L,
+ MF_SORT_BY_PRIORITY_SIZE_L2S,
+};
+
+/* File operation error check options definition */
+#define MF_ERROR_CHECK_SRC_ARG_VALID 0x0001
+#define MF_ERROR_CHECK_DST_ARG_VALID 0x0002
+#define MF_ERROR_CHECK_SRC_EXIST 0x0004
+#define MF_ERROR_CHECK_DST_EXIST 0x0008
+#define MF_ERROR_CHECK_SRC_PATH_VALID 0x0010
+#define MF_ERROR_CHECK_DST_PATH_VALID 0x0020
+#define MF_ERROR_CHECK_SRC_PARENT_DIR_EXIST 0x0040
+#define MF_ERROR_CHECK_DST_PARENT_DIR_EXIST 0x0080
+#define MF_ERROR_CHECK_DUPLICATED 0x0100
+
+/* File system related callback definition */
+typedef int (*myfile_operation_cb) (const char *current_path, const char *destination, int copied_size, FILE * fSource, FILE * fDestination, void *data);
+
+typedef enum {
+ STORAGE_TYPE_NONE = 0,
+ STORAGE_TYPE_LABEL,
+ STORAGE_TYPE_LOCAL,
+ STORAGE_TYPE_MMC,
+ STORAGE_TYPE_MUSIC,
+ STORAGE_TYPE_IMAGE,
+ STORAGE_TYPE_VIDEO,
+ STORAGE_TYPE_DOCUMENT,
+ STORAGE_TYPE_STORAGE,
+} storage_type;
+
+typedef struct _storage_info {
+ char *root_path; /**< Storage path */
+ char *root_name; /**< Storage name */
+ storage_type type; /**< Storage type */
+ char *icon_path;
+ char *uuid;
+ double total;
+ double occupied;
+} storage_info;
+
+typedef struct _node_info {
+ char *parent_path; /**< Node path */
+ char *name; /**< Node name */
+ fsFileType type; /**< Node type */
+ char *thumb_path;
+ Eina_Bool is_selected; /**< Node selected or not */
+ char *storage_name;
+ char *storage_uuid;
+} node_info;
+
+#define GIGABYTE (1024.0*1024.0*1024.0)
+
+typedef struct _FS_NODE_INFO fsNodeInfo;
+struct _FS_NODE_INFO {
+ char *path;
+ char *name;
+ i18n_udate date;
+ fsFileType type;
+ int storage_type;
+ int list_type;
+ char *ext;
+ off_t size;
+ char* thumbnail_path;
+ int thumbnail_type;
+ Elm_Object_Item *item;
+};
+
+#ifndef DEFAULT_ICON
+#define DEFAULT_ICON "my_files_sd_card.png"
+#endif
+
+#define MF_ICON_FOLDER "icon/myfile_icon_folder.png"
+#define MF_ICON_IMAGE "icon/myfile_icon_images.png"
+#define MF_ICON_VIDEO "icon/myfile_icon_video.png"
+#define MF_ICON_MUSIC "icon/myfile_icon_music.png"
+#define MF_ICON_SOUND "icon/myfile_icon_amr.png"
+#define MF_ICON_PDF "icon/myfile_icon_pdf.png"
+#define MF_ICON_DOC "icon/myfile_icon_word.png"
+#define MF_ICON_PPT "icon/myfile_icon_ppt.png"
+#define MF_ICON_EXCEL "icon/myfile_icon_excel.png"
+#define MF_ICON_HTML "icon/myfile_icon_html.png"
+#define MF_ICON_FLASH "icon/myfile_icon_swf.png"
+#define MF_ICON_TXT "icon/myfile_icon_text.png"
+#define MF_ICON_VCONTACT "icon/myfile_icon_vcard.png"
+#define MF_ICON_VCALENDAR "icon/myfile_icon_vcalender.png"
+#define MF_ICON_VNOTE "icon/myfile_icon_vText.png"
+#define MF_ICON_RSS "icon/myfile_icon_rss.png"
+#define MF_ICON_JAVA "icon/myfile_icon_java.png"
+#define MF_ICON_MUSIC_PAUSE "icon/myfile_icon_control_pause.png"
+#define MF_ICON_VIDEO_PLAY "icon/myfile_icon_video_play.png"
+#define MF_ICON_TPK "icon/myfile_icon_tpk.png"
+#define MF_ICON_SNB "icon/myfile_icon_snb.png"
+#define MF_ICON_HWP "icon/myfile_icon_hwp.png"
+#define MF_ICON_GUL "icon/myfile_icon_etc.png"
+#define MF_ICON_EMAIL "icon/myfile_icon_email.png"
+#define MF_ICON_TASK "icon/myfile_icon_task.png"
+#define MF_ICON_ZIP "icon/myfile_icon_zip.png"
+#define MF_ICON_SVG "icon/myfile_icon_svg.png"
+
+typedef enum __mf_list_type mf_list_type;
+enum __mf_list_type {
+ mf_list_recent_files = 0,
+ mf_list_normal,
+};
+
+typedef enum __mf_thumbnail_type mf_thumbnail_type;
+enum __mf_thumbnail_type {
+ MF_THUMBNAIL_TYPE_DEFAULT,
+ MF_THUMBNAIL_TYPE_THUMBNAIL,
+ MF_THUMBNAIL_TYPE_MAX
+};
+
+/*---------- File Attribute Related ----------*/
+
+void mf_file_attr_get_file_size_info(char **file_size, off_t src_size);
+int mf_file_attr_get_file_stat(const char *filename, fsNodeInfo **node);
+int mf_file_attr_get_file_category(const char *filepath, fsFileType *category);
+int mf_file_attr_is_dir(const char *filepath);
+int mf_file_attr_get_store_type_by_full(const char *filepath, MF_STORAGE *store_type);
+int mf_file_attr_get_file_ext(const char *filepath, char **file_ext);
+int mf_file_attr_is_duplicated_name(const char *dir, const char *name);
+int mf_file_attr_is_valid_name(const char *filename);
+int mf_file_attr_is_right_dir_path(const char *dir_path);
+int mf_file_attr_is_right_file_path(const char *file_path);
+int mf_file_attr_get_logical_path_by_full(const char *full_path, char **path);
+int mf_file_attr_get_path_level(const char *fullpath, int *level);
+int mf_file_attr_is_system_dir(char *fullpath, bool *result);
+int mf_file_attr_is_disk_link(const char *fullpath, bool *result);
+int mf_file_attr_get_file_mdate(const char *filename, i18n_udate *date);
+int mf_file_attr_media_has_video(const char *filename);
+int mf_file_attr_get_file_size(const char *filename, off_t *size);
+int mf_file_attr_get_file_icon(const char *file_path, int *error_code, int view_type, char **thumbnail, media_info_h *media_info);
+const char *mf_file_attr_get_recent_default_icon_by_type(fsFileType ftype);
+const char *mf_file_attr_get_default_icon_by_type(fsFileType ftype);
+fsFileType mf_file_attr_get_file_type_by_mime(const char *file_path);
+fsFileType mf_file_attr_get_file_type(const char *mime);
+
+bool __mf_add_storage_info_to_list(media_storage_h storage, void *data);
+
+/*---------- File Operation Related ----------*/
+int mf_fs_oper_error(const char *src, const char *dst, int check_option);
+int mf_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **file_list);
+int mf_fs_oper_create_dir(const char *dir);
+int mf_fs_oper_rename_file(const char *src, const char *dst);
+/*void mf_fs_oper_sort_list(Eina_List **list, int sort_opt);
+int __mf_fs_oper_sort_by_name_cb_A2Z(const void *d1, const void *d2);*/
+
+#endif /*_MYFILE_FILESYSTEM_UTIL_H_*/
#define __AIR_MYFILES_UTILS_H__
#include <inputmgr.h>
+#include "data.h"
Evas_Object *utils_add_window(const char *name);
Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
Evas_Object *content);
bool utils_launch_app(const char *appid, const char *key, const char *value);
bool utils_uninstall_app(const char *pkgid, const char *pkgtype);
+void utils_show_submenu_popup(struct _priv *priv);
+void utils_show_select_folder_popup(struct _priv *priv);
#endif /* __AIR_MYFILES_UTILS_H__ */
#define __AIR_MYFILES_VIEW_H__
view_class *view_base_get_vclass(void);
-view_class *view_action_menu_get_vclass(void);
enum update_type {
UPDATE_ID = 0,
- UPDATE_FAVORITE,
- UPDATE_GRID,
- UPDATE_SHOW_TOAST,
+ UPDATE_FOLDER,
+ UPDATE_FILE,
+ UPDATE_FILE_TO_SELECT,
+ UPDATE_PATH,
};
+enum base_view_layout {
+ E_LAYOUT_DEFAULT = 0,
+ E_LAYOUT_SELECT = 1,
+ E_LAYOUT_MAX
+};
#endif /* __AIR_MYFILES_VIEW_H__ */
<author email="kyuho.jo@samsung.com" href="www.samsung.com">Kyuho Jo</author>
<author email="rimi.kim@samsung.com" href="www.samsung.com">Hyerim Kim</author>
<description>My files application</description>
- <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="true" multiple="false" type="capp" taskmanage="true">
+ <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="false" multiple="false" type="capp" taskmanage="true">
<label>My files</label>
<icon>@DESKTOP_ICON@</icon>
</ui-application>
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+ <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ <privilege>http://tizen.org/privilege/content.write</privilege>
</privileges>
</manifest>
BuildRequires: cmake
BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(libexif)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(app-utils)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(capi-appfw-package-manager)
-BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(storage)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(capi-content-media-content)
+BuildRequires: pkgconfig(capi-base-utils-i18n)
+BuildRequires: pkgconfig(capi-content-mime-type)
+BuildRequires: pkgconfig(capi-media-metadata-extractor)
+BuildRequires: pkgconfig(libtzplatform-config)
+
+BuildRequires: gettext-devel
%define _appdir %{TZ_SYS_RO_APP}/%{name}
%define _bindir %{_appdir}/bin
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../include/define.h"
+
+group {
+ data.item: "focus_highlight" "on";
+ name: GRP_VIEW_DEFAULT;
+ parts {
+ part {
+ name: PART_CONTENT_AREA_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ color: 255 255 255 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_FOLDER_LIST_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_CONTENT_AREA_BG;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: PART_CONTENT_AREA_BG;
+ relative: 0.35 1.0;
+ }
+ align: 0.0 0.0;
+ color: 244 244 244 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "folderlist.border";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_FOLDER_LIST;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_FOLDER_LIST;
+ relative: 1.0 1.0;
+ }
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_FOLDER_LIST;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: PART_FOLDER_LIST_BG;
+ rel2.to: PART_FOLDER_LIST_BG;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "folder.file.border";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: PART_FOLDER_LIST_BG;
+ rel1.relative: 1.0 0.0;
+ rel2.to: PART_FOLDER_LIST_BG;
+ rel2.relative: 1.0 1.0;
+ align: 1.0 0.0;
+ color: 0 0 0 255;
+ min: 1 0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_FILE_LIST_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_CONTENT_AREA_BG;
+ relative: 0.35 0.0;
+ }
+ rel2 {
+ to: PART_CONTENT_AREA_BG;
+ relative: 1.0 1.0;
+ }
+ align: 0.0 0.0;
+ color: 244 244 244 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_FILE_LIST;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: PART_FILE_LIST_BG;
+ rel2.to: PART_FILE_LIST_BG;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../include/define.h"
+
+group {
+ data.item: "focus_highlight" "on";
+ name: GRP_LAYOUT_BASE;
+ parts {
+ part {
+ name: PART_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color : 255 255 255 255;
+ align: 0.5 0.5;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_TOP_TITLE_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_BG;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: PART_BG;
+ relative: 1.0 0.1;
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.title.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_TOP_TITLE_BG;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: PART_TOP_TITLE_BG;
+ relative: 0.0208 1.0;
+ }
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ /*part {
+ name: PART_TOP_TITLE;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding.title.left";
+ rel1.relative: 1.0 0.0;
+ rel2.to_x: PART_MENU;
+ rel2.to_y: PART_TOP_TITLE_BG;
+ rel2.relative: 0.0 1.0;
+ align: 0.5 0.5;
+ visible: 1;
+ }
+ }*/
+ part {
+ name: PART_TOP_TITLE;
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding.title.left";
+ rel1.relative: 1.0 0.0;
+ rel2.to_x: PART_MENU;
+ rel2.to_y: PART_TOP_TITLE_BG;
+ rel2.relative: 0.0 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: STR_MYFILES;
+ size: 28;
+ align: 0.5 0.5;
+ ellipsis: 1;
+ }
+ min: 0 28;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.menu.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_TOP_TITLE_BG;
+ relative: 0.979 0.0;
+ }
+ rel2 {
+ to: PART_TOP_TITLE_BG;
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: PART_MENU;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding.menu.right";
+ rel1.relative: 0.0 0.5;
+ rel2.to: "padding.menu.right";
+ rel2.relative: 0.0 0.5;
+ min: 46 46;
+ align: 1.0 0.5;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.menu.confirm";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 0;
+ rel1 {
+ to: PART_MENU;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: PART_MENU;
+ relative: 0.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: PART_CONFIRM;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding.menu.confirm";
+ rel1.relative: 0.0 0.5;
+ rel2.to: "padding.menu.confirm";
+ rel2.relative: 0.0 0.5;
+ min: 46 46;
+ align: 1.0 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_FILE_PATH_BG;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_TOP_TITLE_BG;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_TOP_TITLE_BG;
+ relative: 1.0 2.0;
+ }
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "filepath.border";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_FILE_PATH_BG;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_FILE_PATH_BG;
+ relative: 1.0 1.0;
+ }
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.file.path.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_FILE_PATH_BG;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: PART_FILE_PATH_BG;
+ relative: 0.0208 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.file.path.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_FILE_PATH_BG;
+ relative: 0.9792 0.0;
+ }
+ rel2 {
+ to: PART_FILE_PATH_BG;
+ relative: 1.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: PART_FILE_PATH;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: padding.file.path.left;
+ rel1.relative: 1.0 0.0;
+ rel2.to: padding.file.path.right;
+ rel2.relative: 0.0 1.0;
+ align: 0.0 0.5;
+ visible: 1;
+ }
+ }
+ part {
+ name: PART_CONTENT_AREA;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_FILE_PATH_BG;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_BG;
+ relative: 1.0 1.0;
+ }
+ align: 0.0 0.0;
+ //color: 244 244 244 255;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "show_confirm";
+ signal: SIG_VISIBLE;
+ source: SOURCE_ELM;
+ action: STATE_SET "visible" 0.0;
+ target: PART_CONFIRM;
+ }
+ program {
+ name: "hide_confirm";
+ signal: SIG_INVISIBLE;
+ source: SOURCE_ELM;
+ action: STATE_SET "default" 0.0;
+ target: PART_CONFIRM;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../include/define.h"
+
+group {
+ name: GRP_DIALOG_POPUP;
+ parts {
+ part {
+ name: "dimmed_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 0 0 0 100;
+ visible: 1;
+ }
+ }
+ part {
+ name: "popup_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 255 255 255 255;
+ visible: 1;
+ rel1 {
+ relative: 0.35 0.35;
+ to : "dimmed_bg";
+ }
+ rel2 {
+ relative: 0.65 0.65;
+ to : "dimmed_bg";
+ }
+ }
+ }
+ part {
+ name: "padding.title.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 0.05 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "padding.title.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.95 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.title.top";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 34;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "popup_bg";
+ }
+ align: 0.5 0.0;
+ fixed: 1 0;
+ }
+ }
+ part {
+ name: "part_title_label";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to_x: "padding.title.left";
+ to_y: "padding.title.top";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to_x: "padding.title.left";
+ to_y: "padding.title.top";
+ relative: 1.0 1.0;
+ }
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "TITLE";
+ size: 28;
+ min: 1 1;
+ ellipsis: -1;
+ }
+ color: 51 51 51 255;
+ min: 0 28;
+ fixed: 1 1;
+ visible: 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "part_content_swallow";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to_x: "padding.title.left";
+ to_y: "part_title_label";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to_x: "padding.title.right";
+ to_y: "part_divider";
+ relative: 0.0 0.0;
+ }
+ visible: 1;
+ }
+ }
+ part {
+ name: "part_divider";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "popup_bg";
+ relative: 0.0 0.80;
+ }
+ rel2 {
+ to: "popup_bg";
+ relative: 1.0 0.80;
+ }
+ min: 0 1;
+ color: 204 204 204 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.buttons";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "part_divider";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+/* part {
+ name: "padding.buttons.top";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "padding.buttons";
+ }
+ rel2 {
+ relative: 1.0 0.15;
+ to: "padding.buttons";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.buttons.bottom";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.85;
+ to: "padding.buttons";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "padding.buttons";
+ }
+ align: 0.0 0.0;
+ }
+ }*/
+ part {
+ name: "part_button_1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ /*relative: 0.02 1.0;
+ to: "padding.buttons.top";*/
+ to: "padding.buttons";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ /*relative: 0.49 0.0;
+ to: "padding.buttons.bottom";*/
+ to: "padding.buttons";
+ relative: 0.5 1.0;
+ }
+ visible: 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "part_button_2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ /*relative: 0.51 1.0;
+ to: "padding.buttons.top";*/
+ to: "part_button_1";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ /*relative: 0.98 0.0;
+ to: "padding.buttons.bottom";*/
+ to: "padding.buttons";
+ relative: 1.0 1.0;
+ }
+ visible: 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+}
+
+group {
+ name: GRP_DIALOG_POPUP_NO_TITLE;
+ parts {
+ part {
+ name: "dimmed_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 0 0 0 100;
+ visible: 1;
+ }
+ }
+ part {
+ name: "popup_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 255 255 255 255;
+ visible: 1;
+ rel1 {
+ relative: 0.35 0.375;
+ to : "dimmed_bg";
+ }
+ rel2 {
+ relative: 0.65 0.625;
+ to : "dimmed_bg";
+ }
+ }
+ }
+ part {
+ name: "padding.title.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 0.05 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.5;
+ }
+ }
+ part {
+ name: "padding.title.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.95 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.title.top";
+ type: SPACER;
+ scale: 1;
+ description {
+ min: 0 34;
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "popup_bg";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "popup_bg";
+ }
+ align: 0.5 0.0;
+ }
+ }
+ part {
+ name: "padding.title.bottom";
+ type: SPACER;
+ scale: 1;
+ description {
+ min: 0 34;
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "part_divider";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "part_divider";
+ }
+ align: 0.5 1.0;
+ }
+ }
+ part {
+ name: "part_content_swallow";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to_x: "padding.title.left";
+ to_y: "padding.title.top";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to_x: "padding.title.right";
+ to_y: "padding.title.bottom";
+ relative: 0.0 0.0;
+ }
+ visible: 1;
+ }
+ }
+ part {
+ name: "part_divider";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "popup_bg";
+ relative: 0.0 0.80;
+ }
+ rel2 {
+ to: "popup_bg";
+ relative: 1.0 0.80;
+ }
+ min: 0 1;
+ color: 204 204 204 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.buttons";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "part_divider";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "popup_bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "part_button_1";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.buttons";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "padding.buttons";
+ relative: 0.5 1.0;
+ }
+ visible: 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "part_button_2";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "part_button_1";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding.buttons";
+ relative: 1.0 1.0;
+ }
+ visible: 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../include/define.h"
+
+group {
+ name: GRP_VIEW_SELECT_FOLDER;
+ parts {
+ part {
+ name: "dimmed_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 0 0 0 102;
+ visible: 1;
+ }
+ }
+ part {
+ name: "select_folder_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 255 255 255 255;
+ visible: 1;
+ rel1 {
+ relative: 0.25 0.25;
+ to : "dimmed_bg";
+ }
+ rel2 {
+ relative: 0.75 0.75;
+ to : "dimmed_bg";
+ }
+ }
+ }
+ part {
+ name: "select_folder_title_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ rel1.to: "select_folder_bg";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "select_folder_bg";
+ rel2.relative: 1.0 0.0;
+ min: 0 60;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.left.top.folder.title";
+ type: SPACER;
+ scale: 1;
+ description {
+ rel1.to : "select_folder_title_bg";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "select_folder_title_bg";
+ rel2.relative: 0.03 0.4;
+ }
+ }
+ part {
+ name: "padding.right.bottom.folder.title";
+ type: SPACER;
+ scale: 1;
+ description {
+ rel1.to : "select_folder_title_bg";
+ rel1.relative: 0.97 0.6;
+ rel2.to: "select_folder_title_bg";
+ rel2.relative: 1.0 1.0;
+ }
+ }
+ part {
+ name: "select_folder_title";
+ type: TEXT;
+ scale: 1;
+ description {
+ rel1.to: "padding.left.top.folder.title";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding.right.bottom.folder.title";
+ rel2.relative: 0.0 0.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "Select target folder";
+ size: 28;
+ min: 1 1;
+ align: 0.0 0.5;
+ ellipsis: -1;
+ }
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "select_folder_title_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to: "select_folder_title_bg";
+ rel2.relative: 1.0 1.0;
+ color: 51 51 51 255;
+ min:0 1;
+ align : 0.0 1.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "select_folder_genlist";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to : "select_folder_title_bg";
+ rel1.relative: 0.0 1.0;
+ rel2.to : "select_folder_newfolder_btn";
+ rel2.relative: 1.0 0.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "select_folder_ok_btn";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to : "select_folder_bg";
+ rel1.relative: 0.0 0.9;
+ rel2.to : "select_folder_bg";
+ rel2.relative: 0.33 1.0;
+ align: 0.0 1.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "select_folder_cancel_btn";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to : "select_folder_ok_btn";
+ rel1.relative: 1.0 0.0;
+ rel2.to : "select_folder_ok_btn";
+ rel2.relative: 2.0 1.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "select_folder_newfolder_btn";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to : "select_folder_cancel_btn";
+ rel1.relative: 1.0 0.0;
+ rel2.to : "select_folder_bg";
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+ name: GRP_VIEW_SUBMENU;
+ parts {
+ part {
+ name: "dimmed_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 0 0 0 100;
+ visible: 1;
+ }
+ }
+ part {
+ name: "submenu_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 0 0;
+ color: 255 255 255 255;
+ visible: 1;
+ rel1 {
+ relative: 0.805 0.072;
+ to : "dimmed_bg";
+ }
+ rel2 {
+ relative: 0.955 0.405;
+ to : "dimmed_bg";
+ }
+ }
+ }
+ part {
+ name: "submenu_genlist";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to : "submenu_bg";
+ rel2.to : "submenu_bg";
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define TRANSITION_TIME 0.17
+#define COLOR_ITEM_FOCUS 0 119 246 255
+#define COLOR_TEXT_INDEX 77 77 77 255
+#define COLOR_TEXT_FOCUS 255 255 255 255
+
+ #include "../../../include/define.h"
+
+group {
+ data.item: "focus_highlight" "on";
+ name: "elm/button/base/menu_btn";
+ images {
+ image: "icon_button_more_rotation.png" COMP;
+ }
+ parts {
+ part {
+ name: "btn_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ color: 0 119 246 255;
+ fixed: 1 1;
+ max: 46 46;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "part_menu_btn";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image.normal: "icon_button_more_rotation.png";
+ align: 0.0 0.0;
+ fixed: 1 1;
+ visible: 1;
+ }
+ /*description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "icon_button_more_rotation.png";
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "icon_button_more_rotation.png";
+ }*/
+ }
+ part {
+ name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ /*program {
+ name: "disabled";
+ signal: SIGNAL_DISABLED;
+ source: SOURCE_ELM;
+ action: STATE_SET "disabled" 0.0;
+ target: btn_bg;
+ target: part_popup_down_btn;
+ }
+ program {
+ name: "focused";
+ signal: SIGNAL_FOCUSED;
+ source: SOURCE_ELM;
+ action: STATE_SET "focused" 0.0;
+ target: btn_bg;
+ target: part_popup_down_btn;
+ }
+ program {
+ name: "unfocused";
+ signal: SIGNAL_UNFOCUSED;
+ source: SOURCE_ELM;
+ action: STATE_SET "default" 0.0;
+ target: btn_bg;
+ target: part_popup_down_btn;
+ }*/
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,clicked,1";
+ source: "event";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ }
+}
+
+group {
+ data.item: "focus_highlight" "on";
+ name: "elm/button/base/target_btn";
+ parts {
+ part {
+ name: "btn_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ color: 0 119 246 255;
+ fixed: 1 1;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.text.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 0;
+ rel1.to: "btn_bg";
+ rel2 {
+ to: "btn_bg";
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.5;
+ fixed: 1 0;
+ }
+ }
+ part {
+ name: "padding.text.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 20 0;
+ rel1 {
+ to: "btn_bg";
+ relative: 1.0 0.0;
+ }
+ rel2.to: "btn_bg";
+ align: 1.0 0.5;
+ fixed: 1 0;
+ }
+ }
+ part {
+ name: "part_popup_btn_text";
+ type: TEXT;
+ scale: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding.text.left";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "padding.text.right";
+ relative: 0.0 1.0;
+ }
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "OK";
+ size: 28;
+ align: 0.5 0.5;
+ min: 1 1;
+ ellipsis: -1;
+ }
+ color: 87 87 87 255;
+ fixed: 1 1;
+ visible: 1;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 87 87 87 127.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_TEXT_FOCUS;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 64 136 211 255;
+ }
+ }
+ part {
+ name: "part_inside_line_up";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 227 227 227 255;
+ rel1.to: "btn_bg";
+ rel2 {
+ to: "btn_bg";
+ relative: 1.0 0.0;
+ }
+ min: 0 1;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 87 87 87 127.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 0 119 246 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 64 136 211 255;
+ }
+ }
+ part {
+ name: "part_inside_line_left";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 227 227 227 255;
+ rel1 {
+ to: "part_inside_line_up";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "btn_bg";
+ relative: 0.0 1.0;
+ }
+ min: 1 0;
+ align: 0.0 0.5;
+ fixed: 1 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 87 87 87 127.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 0 119 246 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 64 136 211 255;
+ }
+ }
+ part {
+ name: "part_inside_line_down";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 227 227 227 255;
+ rel1 {
+ to: "part_inside_line_left";
+ relative: 1.0 1.0;
+ }
+ rel2.to: "btn_bg";
+ min: 0 1;
+ align: 0.5 1.0;
+ fixed: 0 1;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 87 87 87 127.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 0 119 246 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 64 136 211 255;
+ }
+ }
+ part {
+ name: "part_inside_line_right";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 227 227 227 255;
+ rel1 {
+ to: "part_inside_line_up";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "part_inside_line_down";
+ relative: 1.0 0.0;
+ }
+ min: 1 0;
+ align: 1.0 0.5;
+ fixed: 1 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 87 87 87 127.5;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 0 119 246 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 64 136 211 255;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "disabled";
+ signal: SIGNAL_DISABLED;
+ source: SOURCE_ELM;
+ action: STATE_SET "disabled" 0.0;
+ target: btn_bg;
+ target: part_popup_btn_text;
+ target: part_inside_line_down;
+ target: part_inside_line_up;
+ target: part_inside_line_left;
+ target: part_inside_line_right;
+ }
+ program {
+ name: "focused";
+ signal: SIGNAL_FOCUSED;
+ source: SOURCE_ELM;
+ action: STATE_SET "focused" 0.0;
+ target: btn_bg;
+ target: part_popup_btn_text;
+ target: part_inside_line_down;
+ target: part_inside_line_up;
+ target: part_inside_line_left;
+ target: part_inside_line_right;
+ }
+ program {
+ name: "unfocused";
+ signal: SIGNAL_UNFOCUSED;
+ source: SOURCE_ELM;
+ action: STATE_SET "default" 0.0;
+ target: btn_bg;
+ target: part_popup_btn_text;
+ target: part_inside_line_down;
+ target: part_inside_line_up;
+ target: part_inside_line_left;
+ target: part_inside_line_right;
+ }
+ program {
+ name: "selected";
+ signal: "SIGNAL_ITEM_SELECTED";
+ source: "SOURCE_ELM";
+ action: STATE_SET "selected" 0.0;
+ target: btn_bg;
+ target: part_popup_btn_text;
+ target: part_inside_line_down;
+ target: part_inside_line_up;
+ target: part_inside_line_left;
+ target: part_inside_line_right;
+ }
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,clicked,1";
+ source: "event";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+#define DEFAULT 1
+#define SELECTED 2
+#define FOCUSED 3
+#define DISABLED 4
+
+#include "../../../include/define.h"
+
+/*****************************************************************************
+Document: Tizen TV_General Guide_GUI Guideline_v1.0_140508_1.ppt : 36 and 11
+Description: Gengrid for single line text
+******************************************************************************/
+group { name: "elm/gengrid/item/custom_1text/default";
+ data.item: "texts" "elm.text";
+ data.item: "contents" "elm.swallow.end";
+ script {
+ public is_selected, is_enabled, is_focused, is_init, cur_state;
+
+ public init_values() {
+ if(get_int(is_init)==0)
+ {
+ set_int(is_enabled, 1);
+ set_int(is_focused, 1);
+ set_int(is_init, 1);
+ set_int(cur_state, -1);
+ }
+ }
+ public set_states() {
+ new enab;
+ new foc;
+ new sel;
+ new c_state;
+ enab = get_int(is_enabled);
+ foc = get_int(is_focused);
+ sel = get_int(is_selected);
+ c_state = get_int(cur_state);
+ if(enab == 0)
+ {
+ if(c_state!=DISABLED)
+ run_program(PROGRAM:"do_disable");
+ }
+ else
+ {
+ if(foc == 1)
+ {
+ if(c_state!=FOCUSED)
+ run_program(PROGRAM:"do_focus");
+ }
+ else if(sel == 1)
+ {
+ if(c_state!=SELECTED)
+ run_program(PROGRAM:"do_select");
+ }
+ else
+ {
+ if(c_state!=DEFAULT)
+ run_program(PROGRAM:"do_default");
+ }
+ }
+ }
+ }
+ parts {
+ part {
+ name: "event"; type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "base"; type: RECT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ color: 0 119 246 255;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part { name: "bg"; type: RECT; mouse_events: 0;
+ clip_to: "base";
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part { name: "pad.top"; type: SPACER; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 30;
+ max: 9999 30;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ align: 0.5 0.0;
+ }
+ }
+ part { name: "pad.bottom"; type: SPACER; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 25;
+ max: 9999 25;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ align: 0.5 1.0;
+ }
+ }
+ part { name: "pad.left"; type: SPACER; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 20 0;
+ max: 20 9999;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ align: 0.0 0.5;
+ }
+ }
+ part { name: "pad.right"; type: SPACER; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 20 0;
+ max: 20 9999;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ align: 1.0 0.5;
+ }
+ }
+ part { name: "pad.middle"; type: SPACER; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 3;
+ max: 9999 3;
+ rel1.to_x: "pad.left";
+ rel1.to_y: "elm.text";
+ rel1.relative: 1.0 0.0;
+ rel2.to_x: "pad.right";
+ rel2.to_y: "elm.text";
+ rel2.relative: 0.0 0.0;
+ align: 0.5 1.0;
+ }
+ }
+ part { name: "elm.swallow.end";
+ clip_to: "disclip"; type: SWALLOW;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: HORIZONTAL;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ }
+ }
+ part { name: "area_for_text"; type: RECT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1.to_x: "pad.left";
+ rel1.to_y: "pad.top";
+ rel1.relative: 1.0 1.0;
+ rel2.to_x: "pad.right";
+ rel2.to_y: "pad.bottom";
+ rel2.relative: 0.0 0.0;
+ align: 0.5 0.5;
+ color: 255 255 255 0;
+ }
+ }
+ part { name: "elm.text"; type: TEXT; mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ color: 51 51 51 255;
+ rel1.to: "area_for_text";
+ rel2.to: "area_for_text";
+ align: 0.5 0.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ size: 23;
+ min: 0 1;
+ }
+ }
+ description { state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description { state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 51 51 51 255;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 51 51 51 255;
+ }
+ }
+
+ part { name: "disclip"; type: RECT;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1.to: "base";
+ rel2.to: "base";
+ }
+ description { state: "focused" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "selected" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part { name: "event_blocker"; type: RECT; mouse_events: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "focused" 0.0;
+ inherit: "default" 0.0;
+ }
+ description { state: "selected" 0.0;
+ i nherit: "default" 0.0;
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program { name: "go_focused";
+ signal: "elm,state,focused"; source: "elm";
+ script {
+ init_values();
+ set_int(is_focused, 1);
+ set_states();
+ }
+ }
+ program { name: "go_unfocused";
+ signal: "elm,state,unfocused"; source: "elm";
+ script {
+ init_values();
+ set_int(is_focused, 0);
+ set_states();
+ }
+ }
+ program {
+ name: "focused_1";
+ signal: "mouse,in";
+ source: "event_blocker";
+ action: STATE_SET "focused" 0.0;
+ target: "base";
+ target: "elm.text";
+ }
+ program {
+ name: "unfocused_1";
+ signal: "mouse,out";
+ source: "event_blocker";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ target: "elm.text";
+ }
+ program { name: "go_active";
+ signal: "elm,state,selected";
+ source: "elm";
+ script {
+ init_values();
+ set_int(is_selected, 1);
+ set_states();
+ }
+ }
+ program { name: "go_passive";
+ signal: "elm,state,unselected";
+ source: "elm";
+ script {
+ init_values();
+ set_int(is_selected, 0);
+ set_states();
+ }
+ }
+ program { name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ init_values();
+ set_int(is_enabled, 0);
+ set_states();
+ }
+ }
+ program { name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ init_values();
+ set_int(is_enabled, 1);
+ set_states();
+ }
+ }
+ program { name: "do_default";
+ action: STATE_SET "default" 0.0;
+ transition: LINEAR 0.1;
+ target: "base";
+ target: "elm.text";
+ target: "disclip";
+ target: "event_blocker";
+ }
+ program { name: "do_focus";
+ action: STATE_SET "focused" 0.0;
+ target: "base";
+ target: "elm.text";
+ target: "disclip";
+ target: "event_blocker";
+ }
+ program { name: "do_select";
+ action: STATE_SET "selected" 0.0;
+ target: "base";
+ target: "elm.text";
+ target: "disclip";
+ target: "event_blocker";
+ }
+ program { name: "do_disable";
+ action: STATE_SET "disabled" 0.0;
+ target: "base";
+ target: "elm.text";
+ target: "disclip";
+ target: "event_blocker";
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define SOURCE_EDC "edc"
+#define SIGNAL_ITEM_SELECTED "item,selected"
+#define COLOR_TEXT_TITLE 51 51 51 255
+#define COLOR_TEXT_FOCUS 255 255 255 255
+#define COLOR_TEXT_INFO 153 153 153 255
+#define COLOR_ITEM_DEFAULT 119 169 202 255
+#define COLOR_ITEM_FOCUS 0 119 246 255
+#define COLOR_ITEM_FOCUS_0 0 119 246 0
+#define COLOR_ITEM_BG 255 255 255 255
+#define COLOR_ITEM_BORDER 194 194 194 255
+#define FONT_REGULAR "BreezeSans"
+
+#include "../../../include/define.h"
+
+group {
+ name: "elm/genlist/item/custom_folder/default";
+ data.item: "texts" "elm.text.folder";
+ data.item: "contents" "elm.swallow.icon";
+ data.item: "focus_highlight" "on";
+
+ parts {
+ part {
+ name: "genlist_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 119 246 255;
+ min: 0 80;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ rel1.relative: 0.0 1.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.top.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel2.relative: 0.0 0.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.bottom.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 1.0 1.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 1.0 1.0;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1 {
+ to: "padding.top.left";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "padding.top.left";
+ relative: 1.0 1.0;
+ }
+ min: 40 40;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.padding.left_icon";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.icon";
+ relative: 1.0 1.0;
+ }
+ min: 30 0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "elm.text.folder";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.padding.left_icon";
+ rel1.relative: 1.0 0.0;
+ rel2.to: "padding.bottom.right";
+ rel2.relative: 0.0 0.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text";
+ size: 28;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 40;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,in";
+ source: "event";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "elm.text.folder";
+ }
+ program {
+ name: "mouse_unclick_after1";
+ signal: "mouse,out";
+ source: "event";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "elm.text.folder";
+ }
+ program {
+ name: "mouse_unclick_after2";
+ signal: "mouse,in";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "elm.text.folder";
+ }
+ program {
+ name: "mouse_unclick_after3";
+ signal: "mouse,out";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "elm.text.folder";
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/custom_file/default";
+ data.item: "texts" "elm.text1 elm.text2 elm.text3";
+ data.item: "contents" "elm.swallow.icon";
+ data.item: "focus_highlight" "on";
+
+ parts {
+ part {
+ name: "genlist_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 119 246 255;
+ min: 0 80;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ rel1.relative: 0.0 1.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.top.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "genlist_bg";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "genlist_bg";
+ relative: 0.03 0.1;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.bottom.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "genlist_bg";
+ relative: 0.97 0.9;
+ }
+ rel2 {
+ to: "genlist_bg";
+ relative: 1.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to_x: "genlist_bg";
+ rel2.to_y: "padding.bottom.right";
+ rel2.relative: 0.08 0.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.icon.text.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.icon";
+ relative: 1.0 1.0;
+ }
+ min: 30 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "text.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to_x: "padding.icon.text.left";
+ rel1.to_y: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding.bottom.right";
+ rel2.relative: 0.0 0.0;
+ color: 0 119 246 255;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state : "default" 0.0;
+ rel1.to: "text.bg";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "text.bg";
+ rel2.relative: 1.0 0.625;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text";
+ size: 28;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 40;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state : "default" 0.0;
+ rel1.to: "elm.text1";
+ rel1.relative: 0.0 1.0;
+ rel2.to: "text.bg";
+ rel2.relative: 0.3 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text 2";
+ size: 16;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 24;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text3";
+ type: TEXT;
+ description {
+ state : "default" 0.0;
+ rel1.to: "elm.text1";
+ rel1.relative: 0.7 1.0;
+ rel2.to: "text.bg";
+ rel2.relative: 1.0 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text 3";
+ size: 16;
+ align: 1.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 24;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,in";
+ source: "event";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after1";
+ signal: "mouse,out";
+ source: "event";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after2";
+ signal: "mouse,in";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after3";
+ signal: "mouse,out";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/custom_file_select/default";
+ data.item: "texts" "elm.text1 elm.text2 elm.text3";
+ data.item: "contents" "elm.swallow.icon elm.swallow.end";
+ data.item: "focus_highlight" "on";
+
+ parts {
+ part {
+ name: "genlist_bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 119 246 255;
+ min: 0 80;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ rel1.relative: 0.0 1.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.top.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "genlist_bg";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "genlist_bg";
+ relative: 0.03 0.1;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.bottom.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "genlist_bg";
+ relative: 0.97 0.9;
+ }
+ rel2 {
+ to: "genlist_bg";
+ relative: 1.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to_x: "genlist_bg";
+ rel2.to_y: "padding.bottom.right";
+ rel2.relative: 0.08 0.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.icon.text.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.icon";
+ relative: 1.0 1.0;
+ }
+ min: 30 0;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.icon.text.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.end";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.end";
+ relative: 0.0 1.0;
+ }
+ min: 30 0;
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.end";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to_x: "genlist_bg";
+ rel1.to_y: "padding.top.left";
+ rel1.relative: 0.92 1.0;
+ rel2.to_x: "padding.bottom.right";
+ rel2.to_y: "padding.bottom.right";
+ rel2.relative: 0.0 0.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "text.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to_x: "padding.icon.text.left";
+ rel1.to_y: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding.icon.text.right";
+ rel2.relative: 0.0 1.0;
+ color: 0 119 246 255;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.text1";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ rel1.to: "text.bg";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "text.bg";
+ rel2.relative: 1.0 0.625;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text";
+ size: 28;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 40;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text2";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.text1";
+ rel1.relative: 0.0 1.0;
+ rel2.to: "text.bg";
+ rel2.relative: 0.3 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text 2";
+ size: 16;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 24;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.text3";
+ type: TEXT;
+ description {
+ state: "default" 0.0;
+ rel1.to: "elm.text1";
+ rel1.relative: 0.7 1.0;
+ rel2.to: "text.bg";
+ rel2.relative: 1.0 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text 3";
+ size: 16;
+ align: 1.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 24;
+ color: 51 51 51 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,in";
+ source: "event";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after1";
+ signal: "mouse,out";
+ source: "event";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after2";
+ signal: "mouse,in";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ program {
+ name: "mouse_unclick_after3";
+ signal: "mouse,out";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "genlist_bg";
+ target: "text.bg";
+ target: "elm.text1";
+ target: "elm.text2";
+ target: "elm.text3";
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/custom_file_target/default";
+ data.item: "texts" "elm.text.file";
+ data.item: "contents" "elm.swallow.icon elm.swallow.end";
+ data.item: "focus_highlight" "on";
+
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 119 246 255;
+ visible: 0;
+ min: 0 80;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.0 1.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.top.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel2.relative: 0.0 0.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.bottom.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 1.0 1.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 1.0 1.0;
+ }
+ }
+ part {
+ name: "center.bg";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding.bottom.right";
+ rel2.relative: 0.0 0.0;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to: "center.bg";
+ rel1.relative: 0.0 0.0;
+ rel2.to: "center.bg";
+ rel2.relative: 0.045 1.0;
+ align: 0.0 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.icon.text";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.icon";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.icon";
+ relative: 1.0 1.0;
+ }
+ min: 30 0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "elm.text.file";
+ type: TEXT;
+ description {
+ rel1.to: "padding.icon.text";
+ rel1.relative: 1.0 0.0;
+ rel2.to: "padding.text.icon";
+ rel2.relative: 0.0 1.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text";
+ size: 24;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 40;
+ color: 104 104 104 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "padding.text.icon";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "elm.swallow.end";
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "elm.swallow.end";
+ relative: 0.0 1.0;
+ }
+ min: 30 0;
+ align: 1.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "elm.swallow.end";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state : "default" 0.0;
+ rel1.to: "center.bg";
+ rel1.relative: 0.954 0.0;
+ rel2.to: "center.bg";
+ rel2.relative: 1.0 1.0;
+ align: 0.5 0.5;
+ visible: 1;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,in";
+ source: "event";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ target: "elm.text.file";
+ }
+ program {
+ name: "mouse_unclick_after1";
+ signal: "mouse,out";
+ source: "event";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text.file";
+ }
+ program {
+ name: "mouse_unclick_after2";
+ signal: "mouse,in";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ target: "elm.text.file";
+ }
+ program {
+ name: "mouse_unclick_after3";
+ signal: "mouse,out";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text.file";
+ }
+ }
+}
+
+group {
+ name: "elm/genlist/item/custom_1text/default";
+ data.item: "texts" "elm.text";
+ data.item: "focus_highlight" "on";
+
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 119 246 255;
+ visible: 0;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "border";
+ type: RECT;
+ scale: 1;
+ description {
+ rel1.relative: 0.0 1.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 1.0;
+ color: 204 204 204 255;
+ min: 0 3;
+ fixed: 1 1;
+ visible: 1;
+ }
+ }
+ part {
+ name: "padding.top.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel2.relative: 0.0 0.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "padding.bottom.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 1.0 1.0;
+ min: 40 20;
+ fixed: 1 1;
+ align: 1.0 1.0;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ description {
+ rel1.to: "padding.top.left";
+ rel1.relative: 1.0 1.0;
+ rel2.to: "padding.bottom.right";
+ rel2.relative: 0.0 0.0;
+ text {
+ font: FONT_TIZENSANS_LIGHT;
+ text: "test text";
+ size: 24;
+ align: 0.0 0.5;
+ ellipsis: 1;
+ }
+ min: 0 40;
+ color: 104 104 104 255;
+ visible: 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+
+ programs {
+ program {
+ name: "mouse_unclick_after";
+ signal: "mouse,in";
+ source: "event";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ program {
+ name: "mouse_unclick_after1";
+ signal: "mouse,out";
+ source: "event";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ program {
+ name: "mouse_unclick_after2";
+ signal: "mouse,in";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ program {
+ name: "mouse_unclick_after3";
+ signal: "mouse,out";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "elm.text";
+ }
+ program {
+ name: "mouse_unclick_after4";
+ signal: "mouse,clicked,1";
+ source: "event";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ }
+}
#include "../include/define.h"
collections {
- base_scale, 2.0;
+ base_scale: 2.0;
+ #include "edc/widget/genlist.edc"
+ #include "edc/widget/button.edc"
+ #include "edc/widget/gengrid.edc"
}
#include "../include/define.h"
collections {
- base_scale, 2.0;
-
- #include "view/dialog_popup_view.edc"
+ base_scale: 2.0;
+ #include "edc/view/base.edc"
+ #include "edc/layout/default.edc"
+ #include "edc/view/submenu_view.edc"
+ #include "edc/view/select_folder_view.edc"
+ #include "edc/view/dialog_popup.edc"
}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../../include/define.h"
-
-group {
- name: GRP_DIALOG_POPUP;
- parts {
- part {
- name: "dimmed_bg";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- fixed: 0 0;
- color: 0 0 0 100;
- visible: 1;
- }
- }
- part {
- name: "popup_bg";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- fixed: 0 0;
- color: 255 255 255 255;
- visible: 1;
- rel1 {
- relative: 0.3 0.3;
- to : "dimmed_bg";
- }
- rel2 {
- relative: 0.7 0.7;
- to : "dimmed_bg";
- }
- }
- }
- part {
- name: "padding.title.left";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 0.0;
- to: "popup_bg";
- }
- rel2 {
- relative: 0.1 1.0;
- to: "popup_bg";
- }
- align: 0.0 0.5;
- }
- }
- part {
- name: "padding.title.right";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.9 0.0;
- to: "popup_bg";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "popup_bg";
- }
- align: 0.0 0.0;
- }
- }
- part {
- name: "padding.title.top";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 34;
- rel1 {
- relative: 0.0 0.0;
- to: "popup_bg";
- }
- rel2 {
- relative: 1.0 0.0;
- to: "popup_bg";
- }
- align: 0.5 0.0;
- fixed: 1 0;
- }
- part {
- name: "part_title_label";
- type: TEXT;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- to_x: "padding.title.left";
- to_y: "padding.title.top";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x: "padding.title.left";
- to_y: "padding.title.top";
- relative: 1.0 1.0;
- }
- text {
- font: FONT_LIGHT;
- text: "TITLE";
- size: 32;
- min: 1 1;
- ellipsis: -1;
- }
- color: 51 51 51 255;
- min: 0 32;
- fixed: 1 1;
- visible: 1;
- align: 0.0 0.0;
- }
- }
- part {
- name: "padding.content.top";
- type: SPACER;
- scale: 1;
- description {
- min: 0 20;
- state: "default" 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "part_title_label";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "part_title_label";
- }
- align: 0.5 0.0;
- fixed: 0 0;
- }
- }
- part {
- name: "part_content_swallow";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- to_x: "padding.title.left";
- to_y: "padding.content.top";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x: "padding.title.right";
- to_y: "padding.divider.top";
- relative: 0.0 0.0;
- }
- visible: 1;
- }
- }
- part {
- name: "padding.divider.top";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- rel1 {
- to: "popup_bg";
- relative: 0.0 0.75;
- }
- rel2 {
- to: "popup_bg";
- relative: 1.0 0.75;
- }
- align: 0.0 0.5;
- fixed: 0 0;
- }
- }
- part {
- name: "part_divider";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- to: "padding.divider.top";
- relative: 0.0 1.0;
- }
- rel2 {
- to: "padding.divider.top";
- relative: 1.0 1.0;
- }
- min: 0 1;
- color: 204 204 204 255;
- visible: 1;
- }
- }
- part {
- name: "padding.buttons";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "part_divider";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "popup_bg";
- }
- align: 0.0 0.0;
- }
- }
- part {
- name: "padding.buttons.top";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 0.0;
- to: "padding.buttons";
- }
- rel2 {
- relative: 1.0 0.15;
- to: "padding.buttons";
- }
- align: 0.0 0.0;
- }
- }
- part {
- name: "padding.buttons.bottom";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 0.85;
- to: "padding.buttons";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "padding.buttons";
- }
- align: 0.0 0.0;
- }
- }
- part {
- name: "part_button_1";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.02 1.0;
- to: "padding.buttons.top";
- }
- rel2 {
- relative: 0.49 0.0;
- to: "padding.buttons.bottom";
- }
- visible: 1;
- align: 0.0 0.0;
- }
- }
- part {
- name: "part_button_2";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.51 1.0;
- to: "padding.buttons.top";
- }
- rel2 {
- relative: 0.98 0.0;
- to: "padding.buttons.bottom";
- }
- visible: 1;
- align: 0.0 0.0;
- }
- }
- }
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <media_content.h>
+#include <app_debug.h>
+#include <app_contents.h>
+#include <inputmgr.h>
+#include <layoutmgr.h>
+#include <viewmgr.h>
+#include <storage.h>
+
+#include "define.h"
+#include "layout.h"
+#include "view.h"
+#include "data.h"
+#include "util/utils.h"
+#include "util/dialog_popup.h"
+#include "util/fs-util.h"
+#include "util/fs-error.h"
+#include "util/file-util.h"
+
+static char* _folder_list_label_get(void *data, Evas_Object *obj, const char *part);
+static Evas_Object* _folder_list_content_get(void *data, Evas_Object *obj, const char *part);
+static void _folder_list_del(void *data, Evas_Object *obj);
+
+static bool _draw_file_list(struct _priv *priv, int flag);
+static bool _draw_file_list_item_selected(item_data_s *id);
+static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info);
+
+static void _set_folder_item_data(item_data_s *id, fsNodeInfo *node)
+{
+ char *new_path = NULL;
+ char *temp_size = NULL;
+ int buffer_size;
+
+ buffer_size = strlen(node->path) + strlen("/") + strlen(node->name);
+ new_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path, buffer_size+1, "%s%s%s", node->path, "/", node->name);
+
+ id->child = mf_file_ls(new_path);
+ id->parent_path = node->path;
+
+ id->name = node->name;
+ id->node = node;
+
+ mf_file_attr_get_file_size_info(&temp_size, node->size);
+ buffer_size = strlen(temp_size);
+ id->file_size = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(id->file_size, buffer_size+1, "%s", temp_size);
+
+ free(new_path);
+ free(temp_size);
+ return;
+}
+
+static void _item_focus_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *signal = NULL;
+
+ signal = (char *)data;
+
+ if (!strcmp(signal, "item,focused"))
+ elm_object_item_signal_emit(event_info, "mouse,in", "elm");
+ else if (!strcmp(signal, "item,unfocused"))
+ elm_object_item_signal_emit(event_info, "mouse,out", "elm");
+}
+
+static Eina_Bool ecore_timer_cb(void *data)
+{
+ Evas_Object *genlist = (Evas_Object *)data;
+ Elm_Object_Item *it = elm_genlist_selected_item_get(genlist);
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+check_changed_item_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *genlist = (Evas_Object *)data;
+ ecore_timer_add(0.1, ecore_timer_cb, genlist);
+
+ return;
+}
+
+static Evas_Object* create_check(Evas_Object *parent, void *data)
+{
+ Evas_Object *check = NULL;
+
+ check = elm_check_add(parent);
+ evas_object_smart_callback_add(check, "changed", check_changed_item_cb, data);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+
+ return check;
+}
+
+static fsFileType _get_file_type(char *path, char *name)
+{
+ fsFileType fType;
+ int buffer_size = 0;
+
+ char *file_path = NULL;
+
+ buffer_size = strlen(path)+strlen("/")+strlen(name);
+
+ file_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(file_path, buffer_size+1, "%s%s%s", path, "/", name);
+
+ fType = mf_file_attr_get_file_type_by_mime(file_path);
+
+ free(file_path);
+
+ return fType;
+}
+
+static char* _get_file_size(char *path, char *file_name)
+{
+ int buffer_size, file_size;
+ char *file_path = NULL, *size = NULL;
+
+ buffer_size = strlen(path)+strlen("/")+strlen(file_name);
+
+ file_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(file_path, buffer_size+1, "%s%s%s", path, "/", file_name);
+
+ file_size = mf_file_size(file_path);
+ mf_file_attr_get_file_size_info(&size, file_size);
+
+ free(file_path);
+
+ return size;
+}
+
+static void _focus_set(struct _priv *priv, int flag)
+{
+ Evas_Object *folder, *file, *path;
+
+ folder = elm_object_part_content_get(priv->layout, PART_FOLDER_LIST);
+ file = elm_object_part_content_get(priv->layout, PART_FILE_LIST);
+ path = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+
+ if (flag == 1) {
+ elm_object_focus_next_object_set(path, folder, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(folder, path, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(file, path, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(folder, file, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(file, folder, ELM_FOCUS_LEFT);
+ } else if (flag == 2) {
+ elm_object_focus_next_object_set(path, file, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(file, path, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(folder, file, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(file, folder, ELM_FOCUS_LEFT);
+ }
+}
+
+static bool _draw_child_folder_list(Evas_Object *obj, item_data_s *id, Elm_Object_Item *parent)
+{
+ Elm_Object_Item *it = NULL;
+ Eina_List *list = NULL;
+ Eina_List *temp_folder = NULL, *temp_file = NULL;
+ int i = 0, buffer_size, ret;
+ char *new_path = NULL, *new_path2 = NULL;
+
+ item_data_s *id_local;
+ fsNodeInfo *node;
+
+ int count = eina_list_count(id->child);
+ int level;
+
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_folder";
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+
+ for (i = 0; i < count; i++) {
+ list = eina_list_nth_list(id->child, i);
+ char *data = (char *)eina_list_data_get(list);
+
+ buffer_size = strlen(id->parent_path)+strlen("/")+strlen(id->name)+strlen("/")+strlen(data);
+
+ new_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path, buffer_size+1, "%s%s%s%s%s", id->parent_path, "/", id->name, "/", data);
+
+ buffer_size = strlen(id->parent_path)+strlen("/")+strlen(id->name);
+
+ new_path2 = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path2, buffer_size+1, "%s%s%s", id->parent_path, "/", id->name);
+
+ if (mf_is_dir(new_path)) {
+ mf_file_attr_get_path_level(new_path, &level);
+ id_local = calloc(sizeof(item_data_s), 1);
+ id_local->index = i;
+
+ id_local->name = data;
+ id_local->base = id->base;
+ id_local->layout = id->layout;
+ id_local->level = level;
+
+ ret = mf_fs_oper_read_dir(new_path2, &temp_folder, &temp_file);
+ if (ret != MYFILE_ERR_NONE) {
+ free(new_path);
+ free(new_path2);
+ free(id_local->name);
+ free(id_local);
+ return false;
+ }
+ node = (fsNodeInfo *)eina_list_nth(temp_folder, i);
+ _set_folder_item_data(id_local, node);
+
+ it = elm_genlist_item_insert_after(obj, itc, id_local, parent, parent, ELM_GENLIST_ITEM_NONE, _item_selected_cb, id_local);
+ id_local->item = it;
+ elm_object_item_data_set(it, id_local);
+ }
+ }
+
+ elm_genlist_item_class_free(itc);
+
+ free(new_path);
+ free(new_path2);
+ return true;
+}
+
+static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ struct _priv *priv;
+ item_data_s *selected_item = (item_data_s *)elm_object_item_data_get(event_info);
+ path_item_data_s *pld;
+
+ if (selected_item->expanded == 1) {
+ selected_item->expanded = 0;
+ elm_genlist_item_subitems_clear(event_info);
+ elm_object_item_data_set(event_info, selected_item);
+ return;
+ }
+
+ priv = calloc(sizeof(priv), 1);
+ pld = calloc(sizeof(path_item_data_s), 1);
+
+ int buffer_size, same = 0, level;
+
+ priv->base = selected_item->base;
+ priv->layout = selected_item->layout;
+
+ Evas_Object *path_object = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+ const char *last_path = elm_object_item_part_text_get(elm_gengrid_last_item_get(path_object), "elm.text");
+
+ pld = (path_item_data_s *)elm_object_item_data_get(elm_gengrid_last_item_get(path_object));
+
+ selected_item->last_path = last_path;
+
+ char *new_path = NULL;
+
+ if (!strcmp(last_path, "Home")) {
+ buffer_size = strlen(selected_item->parent_path)+strlen("/")+strlen(selected_item->name);
+
+ new_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path, buffer_size+1, "%s%s%s", selected_item->parent_path, "/", selected_item->name);
+ } else {
+ buffer_size = strlen(selected_item->parent_path)+strlen("/")+strlen(selected_item->name);
+
+ new_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path, buffer_size+1, "%s%s%s", selected_item->parent_path, "/", selected_item->name);
+
+ mf_file_attr_get_path_level(new_path, &level);
+ if (pld->level == level)
+ same = 1;
+ else if (pld->level < level)
+ same = 0;
+ else
+ same = level - pld->level;
+ }
+
+ if (selected_item->child != NULL && eina_list_count(selected_item->child)) {
+ if (!_draw_child_folder_list(obj, selected_item, event_info)) {
+ _ERR("_draw_child_folder_list failed.");
+
+ if (!new_path)
+ free(new_path);
+ if (!pld)
+ free(pld);
+ return;
+ }
+ selected_item->expanded = 1;
+ }
+
+ priv->selected_parent_path = selected_item->parent_path;
+ priv->selected_folder = selected_item->name;
+ priv->same = same;
+ priv->expanded = selected_item->expanded;
+
+ viewmgr_update_view(VIEW_BASE, UPDATE_PATH, priv);
+
+ if (!_draw_file_list_item_selected(selected_item)) {
+ _ERR("_draw_file_list_item_selected failed.");
+
+ if (!new_path)
+ free(new_path);
+ if (!pld)
+ free(pld);
+ return;
+ }
+
+ if (!new_path)
+ free(new_path);
+ if (!pld)
+ free(pld);
+
+ return;
+}
+
+static char*
+_file_list_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[256];
+ item_data_s *id = (item_data_s *)data;
+
+ if (!strcmp("elm.text1", part)) {
+ if (id->is_empty) {
+ if (id->index == 0)
+ snprintf(buf, sizeof(buf), "%s", ".");
+ else if (id->index == 1)
+ snprintf(buf, sizeof(buf), "%s", "..");
+ } else {
+ if (id->name != NULL)
+ snprintf(buf, sizeof(buf), "%s", id->name);
+ else
+ return NULL;
+ }
+ return strdup(buf);
+ } else if (!strcmp("elm.text2", part)) {
+ if (id->file_size == NULL)
+ return NULL;
+ else
+ snprintf(buf, sizeof(buf), "%s", id->file_size);
+
+ return strdup(buf);
+ } else if (!strcmp("elm.text3", part)) {
+ snprintf(buf, sizeof(buf), "2016/04/12");
+ return strdup(buf);
+ }
+
+ return NULL;
+}
+
+
+static char*
+_folder_list_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[256];
+ item_data_s *id = (item_data_s *)data;
+ Eina_List *list;
+
+ if (!strcmp("elm.text.folder", part)) {
+ snprintf(buf, sizeof(buf), "%s", id->name);
+ return strdup(buf);
+ } else if (!strcmp("elm.text1", part)) {
+ if (eina_list_count(id->child) == 0 || id->is_home == 1) {
+ if (id->index == 0)
+ snprintf(buf, sizeof(buf), "%s", ".");
+ else if (id->index == 1)
+ snprintf(buf, sizeof(buf), "%s", "..");
+ } else {
+ list = eina_list_nth_list(id->child, id->index);
+ char *data = (char *)eina_list_data_get(list);
+ snprintf(buf, sizeof(buf), "%s", data);
+ }
+ return strdup(buf);
+ } else if (!strcmp("elm.text2", part)) {
+ if (id->file_size == NULL)
+ return NULL;
+ else
+ snprintf(buf, sizeof(buf), "%s", id->file_size);
+ return strdup(buf);
+ } else if (!strcmp("elm.text3", part)) {
+ snprintf(buf, sizeof(buf), "2016/04/12");
+ return strdup(buf);
+ }
+
+ return NULL;
+}
+
+static Evas_Object*
+_folder_list_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ item_data_s *id = (item_data_s *)data;
+
+ if (!strcmp("elm.swallow.icon", part)) {
+ Evas_Object *icon = elm_image_add(obj);
+
+ if (id->type == FILE_TYPE_IMAGE)
+ elm_image_file_set(icon, IMGDIR"/icon/myfile_icon_images.png", NULL);
+ else
+ elm_image_file_set(icon, IMGDIR"/icon/myfile_icon_folder.png", NULL);
+
+ return icon;
+ } else if (!strcmp("elm.swallow.end", part))
+ return create_check(obj, data);
+
+ return NULL;
+}
+
+static void
+_folder_list_del(void *data, Evas_Object *obj)
+{
+/* Unrealized callback can be called after this.
+ * Accessing item_data_s can be dangerous on unrealized callback.
+*/
+ item_data_s *id = (item_data_s *)data;
+ free(id);
+}
+
+static bool _draw_folder_list(struct _priv *priv)
+{
+ Evas_Object *scroller = NULL;
+ Evas_Object *genlist = NULL;
+
+ Elm_Object_Item *it = NULL;
+ item_data_s *id;
+ list_data_s *list_data = calloc(sizeof(list_data_s), 1);
+
+ fsNodeInfo *node = NULL;
+
+ char *path = NULL;
+
+ scroller = elm_scroller_add(priv->layout);
+ genlist = elm_genlist_add(scroller);
+ elm_object_focus_allow_set(genlist, EINA_TRUE);
+
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_folder";
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+
+ path = Get_Root_Path(STORAGE_TYPE_INTERNAL);
+
+ list_data->path = path;
+
+ int ret = mf_fs_oper_read_dir(list_data->path, &list_data->folder_list, &list_data->file_list);
+ if (ret != MYFILE_ERR_NONE) {
+ free(path);
+ free(list_data->path);
+ free(list_data);
+ return false;
+ }
+
+ list_data->file_count = eina_list_count(list_data->file_list);
+ list_data->folder_count = eina_list_count(list_data->folder_list);
+
+ int i;
+
+ for (i = 0; i < list_data->folder_count; i++) {
+ id = calloc(sizeof(item_data_s), 1);
+ id->index = i;
+
+ node = (fsNodeInfo *)eina_list_nth(list_data->folder_list, i);
+ id->base = priv->base;
+ id->layout = priv->layout;
+ id->expanded = 0;
+ id->level = 1;
+ _set_folder_item_data(id, node);
+
+ it = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _item_selected_cb, id);
+ id->item = it;
+ elm_object_item_data_set(it, id);
+ }
+
+ elm_genlist_item_class_free(itc);
+
+ elm_object_part_content_set(priv->layout, PART_FOLDER_LIST, scroller);
+ elm_object_content_set(scroller, genlist);
+
+ evas_object_smart_callback_add(genlist, "item,focused", _item_focus_cb, "item,focused");
+ evas_object_smart_callback_add(genlist, "item,unfocused", _item_focus_cb, "item,unfocused");
+
+ free(list_data);
+ free(path);
+
+ return true;
+}
+
+static bool _draw_file_list_item_selected(item_data_s *id)
+{
+ Evas_Object *scroller = NULL;
+ Evas_Object *genlist = NULL;
+
+ scroller = elm_scroller_add(id->layout);
+ genlist = elm_genlist_add(scroller);
+ elm_object_focus_allow_set(genlist, EINA_TRUE);
+
+ Elm_Object_Item *it = NULL;
+ Elm_Genlist_Item_Class *itc = NULL;
+
+ item_data_s *id_local = NULL;
+
+ char *path = NULL;
+
+ int buffer_size = strlen(id->parent_path)+strlen("/")+strlen(id->name);
+ path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(path, buffer_size+1, "%s%s%s", id->parent_path, "/", id->name);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_file";
+ itc->func.text_get = _file_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+
+ int i, total_count = 0;
+
+ if (id->child != NULL)
+ total_count = eina_list_count(id->child);
+
+ if (!total_count)
+ id->is_empty = 1;
+ else
+ id->is_empty = 0;
+
+ Eina_List *list = NULL;
+
+ if (total_count == 0) {
+ for (i = 0; i < 2; i++) {
+ id_local = calloc(sizeof(item_data_s), 1);
+ id_local->index = i;
+
+ id_local->is_empty = id->is_empty;
+
+ it = elm_genlist_item_append(genlist, itc, id_local, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ id_local->item = it;
+ }
+ } else {
+ for (i = 0; i < total_count; i++) {
+ id_local = calloc(sizeof(item_data_s), 1);
+ id_local->index = i;
+
+ list = eina_list_nth_list(id->child, i);
+ id_local->name = (char *)eina_list_data_get(list);
+
+ id_local->type = _get_file_type(path, id_local->name);
+ id_local->file_size = _get_file_size(path, id_local->name);
+ id_local->is_empty = id->is_empty;
+
+ it = elm_genlist_item_append(genlist, itc, id_local, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ id_local->item = it;
+ }
+ }
+
+ elm_genlist_item_class_free(itc);
+ elm_object_part_content_set(id->layout, PART_FILE_LIST, scroller);
+
+ elm_object_content_set(scroller, genlist);
+
+ evas_object_smart_callback_add(genlist, "item,focused", _item_focus_cb, "item,focused");
+ evas_object_smart_callback_add(genlist, "item,unfocused", _item_focus_cb, "item,unfocused");
+
+ Evas_Object *folder = elm_object_part_content_get(id->layout, PART_FOLDER_LIST);
+ Evas_Object *file = elm_object_part_content_get(id->layout, PART_FILE_LIST);
+ Evas_Object *path_obj = elm_object_part_content_get(id->base, PART_FILE_PATH);
+
+ elm_object_focus_next_object_set(path_obj, folder, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(folder, path_obj, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(file, path_obj, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(folder, file, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(file, folder, ELM_FOCUS_LEFT);
+
+ free(path);
+
+ return true;
+}
+
+static bool _draw_file_list_root(struct _priv *priv)
+{
+ Evas_Object *scroller = NULL;
+ Evas_Object *genlist = NULL;
+
+ Elm_Object_Item *it = NULL;
+ item_data_s *id;
+ Elm_Genlist_Item_Class *itc;
+
+ int i = 0;
+
+ scroller = elm_scroller_add(priv->layout);
+ genlist = elm_genlist_add(scroller);
+ elm_object_focus_allow_set(genlist, EINA_TRUE);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_file";
+
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+
+ for (i = 0; i < 2; i++) {
+ id = calloc(sizeof(item_data_s), 1);
+ id->index = i;
+ id->is_home = 1;
+
+ elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ id->item = it;
+ }
+
+ elm_genlist_item_class_free(itc);
+ elm_object_part_content_set(priv->layout, PART_FILE_LIST, scroller);
+
+ elm_object_content_set(scroller, genlist);
+
+ evas_object_smart_callback_add(genlist, "item,focused", _item_focus_cb, "item,focused");
+ evas_object_smart_callback_add(genlist, "item,unfocused", _item_focus_cb, "item,unfocused");
+
+ return true;
+}
+
+static bool _draw_file_list(struct _priv *priv, int flag)
+{
+ Evas_Object *scroller = NULL;
+ Evas_Object *genlist = NULL;
+
+ item_data_s *id;
+ Elm_Genlist_Item_Class *itc;
+
+ int is_home = 0;
+
+ char *path = NULL;
+
+ if (priv->selected_folder == NULL) {
+ is_home = 1;
+ int buffer_size = strlen(priv->selected_parent_path);
+ path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(path, buffer_size+1, "%s", priv->selected_parent_path);
+ } else {
+ int buffer_size = strlen(priv->selected_parent_path)+strlen("/")+strlen(priv->selected_folder);
+
+ path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(path, buffer_size+1, "%s%s%s", priv->selected_parent_path, "/", priv->selected_folder);
+ is_home = 0;
+ }
+
+ scroller = elm_scroller_add(priv->layout);
+ genlist = elm_genlist_add(scroller);
+ elm_object_focus_allow_set(genlist, EINA_TRUE);
+
+ if (flag == 2) {
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_file_select";
+
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+ } else {
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_file";
+
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+ }
+
+ int i, total_count;
+
+ Eina_List *list = mf_file_ls(path);
+ total_count = eina_list_count(list);
+
+ Eina_List *temp;
+
+ if (total_count == 0 || is_home == 1) {
+ for (i = 0; i < 2; i++) {
+ id = calloc(sizeof(item_data_s), 1);
+ id->index = i;
+ id->is_home = is_home;
+
+ elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ } else {
+ for (i = 0; i < total_count; i++) {
+ id = calloc(sizeof(item_data_s), 1);
+ id->index = i;
+ id->is_home = is_home;
+ id->child = list;
+ temp = eina_list_nth_list(list, i);
+
+ id->name = (char *)eina_list_data_get(temp);;
+ id->file_size = _get_file_size(path, id->name);
+ id->type = _get_file_type(path, id->name);
+
+ elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ }
+
+ elm_genlist_item_class_free(itc);
+ elm_object_part_content_set(priv->layout, PART_FILE_LIST, scroller);
+
+ elm_object_content_set(scroller, genlist);
+
+ _focus_set(priv, flag);
+
+ evas_object_smart_callback_add(genlist, "item,focused", _item_focus_cb, "item,focused");
+ evas_object_smart_callback_add(genlist, "item,unfocused", _item_focus_cb, "item,unfocused");
+
+ free(path);
+
+ return true;
+}
+
+static void _draw_view_content(struct _priv *priv)
+{
+ if (!_draw_folder_list(priv)) {
+ _ERR("Draw folder list failed.");
+ return;
+ }
+ if (!_draw_file_list_root(priv)) {
+ _ERR("Draw file list failed.");
+ return;
+ }
+}
+
+
+static bool _create(layoutmgr *lmgr, void *data)
+{
+ struct _priv *priv;
+ Evas_Object *base, *layout;
+
+ if (!lmgr) {
+ _ERR("failed to get layoutmgr");
+ return false;
+ }
+
+ priv = calloc(1, sizeof(*priv));
+ priv = data;
+ if (!priv) {
+ _ERR("failed to allocate priv");
+ return false;
+ }
+
+ base = layoutmgr_get_base(lmgr);
+ if (!base) {
+ _ERR("failed to get base object");
+ goto err;
+ }
+
+ layout = elm_layout_add(base);
+ if (!layout) {
+ _ERR("failed to create layout");
+ goto err;
+ }
+
+ if (!elm_layout_file_set(layout, EDJEFILE, GRP_VIEW_DEFAULT)) {
+ _ERR("failed to set layout file");
+ goto err2;
+ }
+
+ priv->base = base;
+ priv->layout = layout;
+ priv->lmgr = lmgr;
+
+ layoutmgr_set_layout_data(lmgr, LAYOUT_DEFAULT, priv);
+ _draw_view_content(priv);
+
+ _focus_set(priv, 1);
+
+ return true;
+
+err2:
+ evas_object_del(layout);
+err:
+ free(priv);
+ return false;
+}
+
+static void _destroy(void *layout_data)
+{
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("failed to get layout data");
+ return;
+ }
+
+ priv = layout_data;
+
+ evas_object_del(priv->layout);
+
+ free(priv);
+}
+
+static void _show(void *layout_data)
+{
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("failed to layout data");
+ return;
+ }
+
+ priv = layout_data;
+
+ evas_object_show(priv->layout);
+ elm_object_part_content_set(priv->base, PART_CONTENT_AREA, priv->layout);
+}
+
+static void _hide(void *layout_data)
+{
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("failed to get layout data");
+ return;
+ }
+
+ priv = layout_data;
+
+ evas_object_hide(priv->layout);
+ elm_object_part_content_unset(priv->base, PART_CONTENT_AREA);
+}
+
+static void _update(void *layout_data, int update_type, void *data)
+{
+ struct _priv *priv;
+
+ if (!layout_data) {
+ _ERR("failed to get layout data");
+ return;
+ }
+
+ priv = layout_data;
+
+ switch (update_type) {
+ case UPDATE_FILE:
+ elm_object_disabled_set(elm_object_part_content_get(priv->layout, PART_FOLDER_LIST), EINA_FALSE);
+ _draw_file_list(priv, 1);
+ break;
+
+ case UPDATE_FILE_TO_SELECT:
+ elm_object_disabled_set(elm_object_part_content_get(priv->layout, PART_FOLDER_LIST), EINA_TRUE);
+ _draw_file_list(priv, 2);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static layout_class _lclass = {
+ .layout_id = LAYOUT_DEFAULT,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy,
+ .update = _update,
+};
+
+layout_class *layout_default_get_lclass(void)
+{
+ return &_lclass;
+}
#include <app_define.h>
#include "define.h"
-#include "utils.h"
#include "view.h"
+#include "util/utils.h"
SET_TAG(PACKAGE);
}
if (!viewmgr_add_view(view_base_get_vclass(), NULL)) {
- _ERR("Add view failed.");
+ _ERR("Add view base failed.");
goto err;
}
ad = data;
if (!viewmgr_remove_view(VIEW_BASE))
- _ERR("Remove view failed.");
-
- if (!viewmgr_remove_view(VIEW_ACTION_MENU))
- _ERR("Remove view failed.");
+ _ERR("Remove view default failed.");
if (!viewmgr_destroy())
_ERR("Destroy viewmgr failed.");
static void _pause(void *data)
{
- view_state state;
+ /*view_state state;
state = viewmgr_get_view_state(VIEW_ACTION_MENU);
if (state == VIEW_STATE_VISIBLE)
- viewmgr_hide_view(VIEW_ACTION_MENU);
+ viewmgr_hide_view(VIEW_ACTION_MENU);*/
inputmgr_enable(EINA_FALSE);
}
#include <Elementary.h>
#include <viewmgr.h>
#include <inputmgr.h>
+#include <layoutmgr.h>
#include <app_contents.h>
#include <app_define.h>
#include <app_debug.h>
-
#include "define.h"
-#include "utils.h"
#include "view.h"
-#include "dialog_popup_view.h"
+#include "data.h"
+#include "util/utils.h"
+#include "util/dialog_popup.h"
+
+#define STYLE_TARGET_BTN "target_btn"
+
+static void _down_btn_cb(void *data, Evas_Object *obj, void *event_info);
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev);
+
+static input_handler focus_handler = {
+ .mouse_move = _mouse_move
+};
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev)
+{
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static void _down_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del((Evas_Object *)data);
+}
-Evas_Object *dialog_popup_create(Evas_Object *win, dialog_popup_info_t *dialog_popup_info)
+Evas_Object *dialog_popup_create(dialog_popup_info_t *dialog_popup_info)
{
Evas_Object *dialog_popup = NULL;
Evas_Object *window_layout = NULL;
Evas_Object *button_1 = NULL, *button_2 = NULL;
- Evas_Object *scroller = NULL;
Evas_Object *content_label = NULL;
Evas_Object *content_check = NULL;
Evas_Object *content_entry = NULL;
goto out;
}
+ struct _priv *priv;
+ priv = dialog_popup_info->data;
+
/* Creating a Notification Window */
dialog_popup = elm_win_add(NULL, "dialog_popup", ELM_WIN_BASIC);
goto out;
}
+ priv->popup_win = dialog_popup;
+
elm_win_alpha_set(dialog_popup, EINA_TRUE);
elm_win_borderless_set(dialog_popup, EINA_TRUE);
elm_win_autodel_set(dialog_popup, EINA_TRUE);
/* Layout */
window_layout = elm_layout_add(dialog_popup);
- result = elm_layout_file_set(window_layout, EDJEFILE, GRP_DIALOG_POPUP);
+ if (dialog_popup_info->dialog_popup_type == DIALOG_POPUP_TYPE_YES_OR_CANCEL)
+ result = elm_layout_file_set(window_layout, EDJEFILE, GRP_DIALOG_POPUP_NO_TITLE);
+ else
+ result = elm_layout_file_set(window_layout, EDJEFILE, GRP_DIALOG_POPUP);
+
_DBG("Layout elm_layout_file_set for [%s] returns [%d]", EDJEFILE, result);
evas_object_resize(window_layout, screen_w, screen_h);
evas_object_show(window_layout);
- /* content - title */
- if (dialog_popup_info->title) {
- elm_object_part_text_set(window_layout, "part_title_label", dialog_popup_info->title);
- }
-
- /* content - scroller */
- scroller = elm_scroller_add(window_layout);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_object_part_content_set(window_layout, "part_content_swallow", scroller);
- elm_object_scale_set(scroller, 1/edje_scale_get());
- evas_object_show(scroller);
-
if (dialog_popup_info->dialog_popup_type == DIALOG_POPUP_TYPE_INPUT_NAME) {
/* entry */
- content_entry = elm_entry_add (scroller);
+ content_entry = elm_entry_add(window_layout);
+
+ if (dialog_popup_info->title)
+ elm_object_part_text_set(window_layout, "part_title_label", dialog_popup_info->title);
if (content_entry == NULL) {
_ERR("elm_entry_add failed");
goto out;
}
+ elm_object_part_content_set(window_layout, "part_content_swallow", content_entry);
elm_entry_single_line_set(content_entry, EINA_TRUE);
elm_entry_editable_set(content_entry, EINA_TRUE);
- elm_object_content_set(scroller, content_entry);
+ elm_object_part_text_set(content_entry, "guide", "Input folder/file name");
- if (dialog_popup_info->content) {
+ if (dialog_popup_info->content)
elm_object_text_set(content_entry, dialog_popup_info->content);
- }
evas_object_show(content_entry);
- }
- else if (dialog_popup_info->dialog_popup_type == DIALOG_POPUP_TYPE_CONFIGURATION)
- {
+ } else if (dialog_popup_info->dialog_popup_type == DIALOG_POPUP_TYPE_CONFIGURATION) {
+ if (dialog_popup_info->title)
+ elm_object_part_text_set(window_layout, "part_title_label", dialog_popup_info->title);
+
/* check */
- content_check = elm_check_add(scroller);
+ content_check = elm_check_add(window_layout);
if (content_check == NULL) {
_ERR("elm_check_add failed");
goto out;
}
- if (dialog_popup_info->content) {
+ if (dialog_popup_info->content)
elm_object_text_set(content_check, dialog_popup_info->content);
- }
- elm_object_content_set(scroller, content_check);
+
+ elm_object_part_content_set(window_layout, "part_content_swallow", content_check);
evas_object_show(content_check);
- }
- else {
+ } else {
/* label */
int content_len = 0;
int buffer_size = 0;
- const char *start_tag = "<font=BreezeSans:style=Light color=#686868 align=left linesize=46 font_size=32>";
+ const char *start_tag = "<font=BreezeSans:style=Light color=#686868 align=left left_margin=20 font_size=28>";
const char *end_tag = "</font>";
- content_label = elm_label_add(scroller);
+ content_label = elm_label_add(window_layout);
if (content_label == NULL) {
_ERR("elm_label_add failed");
goto out;
}
- elm_label_line_wrap_set(content_label, ELM_WRAP_WORD);
- elm_label_wrap_width_set(content_label, 563);
-
if (dialog_popup_info->content) {
content_len = strlen(dialog_popup_info->content);
buffer_size = strlen(start_tag) + content_len + strlen(end_tag);
content = (char*)calloc(buffer_size + 1, sizeof(char));
- snprintf(content, buffer_size, "%s%s%s", start_tag, dialog_popup_info->content, end_tag);
+ snprintf(content, buffer_size+1, "%s%s%s", start_tag, dialog_popup_info->content, end_tag);
elm_object_text_set(content_label, content);
}
- elm_object_content_set(scroller, content_label);
+ elm_object_part_content_set(window_layout, "part_content_swallow", content_label);
+ elm_object_scale_set(content_label, 1/edje_scale_get());
evas_object_show(content_label);
}
/* buttons */
button_1 = elm_button_add(window_layout);
- if (dialog_popup_info->button_1_text) {
- elm_object_text_set(button_1, dialog_popup_info->button_1_text);
- }
elm_object_focus_allow_set(button_1, EINA_TRUE);
elm_object_part_content_set(window_layout, "part_button_1", button_1);
+ elm_object_style_set(button_1, STYLE_TARGET_BTN);
+ if (dialog_popup_info->button_1_text)
+ elm_object_part_text_set(button_1, "part_popup_btn_text", dialog_popup_info->button_1_text);
+ else
+ elm_object_part_text_set(button_1, "part_popup_btn_text", "OK");
+
evas_object_show(button_1);
button_2 = elm_button_add(window_layout);
- if (dialog_popup_info->button_2_text) {
- elm_object_text_set(button_2, dialog_popup_info->button_2_text);
- }
elm_object_focus_allow_set(button_2, EINA_TRUE);
elm_object_part_content_set(window_layout, "part_button_2", button_2);
+ elm_object_style_set(button_2, STYLE_TARGET_BTN);
+ if (dialog_popup_info->button_2_text)
+ elm_object_part_text_set(button_2, "part_popup_btn_text", dialog_popup_info->button_2_text);
+ else
+ elm_object_part_text_set(button_2, "part_popup_btn_text", "Cancel");
+
evas_object_show(button_2);
+ inputmgr_add_callback(button_1, 0, &focus_handler, dialog_popup);
+ inputmgr_add_callback(button_2, 0, &focus_handler, dialog_popup);
+
+ evas_object_smart_callback_add(button_2, "clicked", _down_btn_cb, dialog_popup);
+
evas_object_show(dialog_popup);
elm_win_activate(dialog_popup);
out:
- if(content != NULL)
+ if (content != NULL)
free(content);
return dialog_popup;
--- /dev/null
+/*
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#include <regex.h>
+#include <sys/types.h>
+#include <media_content.h>
+#include <assert.h>
+#include <app.h>
+#include <metadata_extractor.h>
+#include <mime_type.h>
+#include <glib.h>
+#include <app_debug.h>
+
+#include "data.h"
+#include "util/fs-util.h"
+#include "util/fs-error.h"
+#include "util/file-util.h"
+
+#define MF_UDATE_NUM 1000
+#define MYFILE_BASIC_SIZE 1024
+#define MF_ROUND_D(x, dig) (floor((x) * pow(10, dig+1) + 0.5) / pow(10, dig+1))
+
+#define MF_PHONE_DEFAULT_LEVEL 3 /*the phone path is /opt/usr/media, it consists of opt and media two parts*/
+#define MF_MMC_DEFAULT_LEVEL 3 /*the mmc path is /opt/storage/sdcard, it consists of opt and storage and sdcard three parts*/
+typedef struct __mf_filter_s mf_filter_s;
+struct __mf_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*/
+};
+#define CONDITION_LENGTH 200
+#define MF_CONDITION_IMAGE_VIDEO "(MEDIA_TYPE=0 OR MEDIA_TYPE=1 OR MEDIA_TYPE=2 OR MEDIA_TYPE=3)"
+
+struct _ftype_by_mime {
+ const char *mime;
+ fsFileType ftype;
+};
+
+static struct _ftype_by_mime mime_type[] = {
+ {"image/png", FILE_TYPE_IMAGE},
+ {"image/jpeg", FILE_TYPE_IMAGE},
+ {"image/gif", FILE_TYPE_IMAGE},
+ {"image/bmp", FILE_TYPE_IMAGE},
+ {"image/vnd.wap.wbmp", FILE_TYPE_IMAGE},
+ {"image/jp2", FILE_TYPE_IMAGE},
+ {"image/tif", FILE_TYPE_IMAGE},
+ {"image/wmf", FILE_TYPE_IMAGE},
+
+ /*FILE_TYPE_VIDEO */
+ {"video/x-msvideo", FILE_TYPE_VIDEO},
+ {"video/mp4", FILE_TYPE_VIDEO},
+ {"video/3gpp", FILE_TYPE_VIDEO},
+ {"video/x-ms-asf", FILE_TYPE_VIDEO},
+ {"video/x-ms-wmv", FILE_TYPE_VIDEO},
+ {"video/x-matroska", FILE_TYPE_VIDEO},
+
+ /*FILE_TYPE_MUSIC */
+ {"audio/mpeg", FILE_TYPE_MUSIC},
+ {"audio/x-wav", FILE_TYPE_MUSIC},
+ {"application/x-smaf", FILE_TYPE_MUSIC},
+ {"audio/mxmf", FILE_TYPE_MUSIC},
+ {"audio/midi", FILE_TYPE_MUSIC},
+ {"audio/x-xmf", FILE_TYPE_MUSIC},
+ {"audio/x-ms-wma", FILE_TYPE_MUSIC},
+ {"audio/aac", FILE_TYPE_MUSIC},
+ {"audio/ac3", FILE_TYPE_MUSIC},
+ {"audio/ogg", FILE_TYPE_MUSIC},
+ {"audio/ra", FILE_TYPE_MUSIC},
+ {"audio/x-vorbis+ogg", FILE_TYPE_MUSIC},
+ {"audio/vorbis", FILE_TYPE_MUSIC},
+ {"audio/imelody", FILE_TYPE_MUSIC},
+ {"audio/iMelody", FILE_TYPE_MUSIC},
+ {"audio/x-rmf", FILE_TYPE_MUSIC},
+ {"application/vnd.smaf", FILE_TYPE_MUSIC},
+ {"audio/mobile-xmf", FILE_TYPE_MUSIC},
+ {"audio/mid", FILE_TYPE_MUSIC},
+ {"audio/vnd.ms-playready.media.pya", FILE_TYPE_MUSIC},
+ {"audio/imy", FILE_TYPE_MUSIC},
+ {"audio/m4a", FILE_TYPE_VOICE},
+ {"audio/melody", FILE_TYPE_MUSIC},
+ {"audio/mmf", FILE_TYPE_MUSIC},
+ {"audio/mp3", FILE_TYPE_MUSIC},
+ {"audio/mp4", FILE_TYPE_MUSIC},
+ {"audio/MP4A-LATM", FILE_TYPE_MUSIC},
+ {"audio/mpeg3", FILE_TYPE_MUSIC},
+ {"audio/mpeg4", FILE_TYPE_MUSIC},
+ {"audio/mpg", FILE_TYPE_MUSIC},
+ {"audio/mpg3", FILE_TYPE_MUSIC},
+ {"audio/smaf", FILE_TYPE_MUSIC},
+ {"audio/sp-midi", FILE_TYPE_MUSIC},
+ {"audio/wav", FILE_TYPE_MUSIC},
+ {"audio/wave", FILE_TYPE_MUSIC},
+ {"audio/wma", FILE_TYPE_MUSIC},
+ {"audio/xmf", FILE_TYPE_MUSIC},
+ {"audio/x-mid", FILE_TYPE_MUSIC},
+ {"audio/x-midi", FILE_TYPE_MUSIC},
+ {"audio/x-mp3", FILE_TYPE_MUSIC},
+ {"audio/-mpeg", FILE_TYPE_MUSIC},
+ {"audio/x-mpeg", FILE_TYPE_MUSIC},
+ {"audio/x-mpegaudio", FILE_TYPE_MUSIC},
+ {"audio/x-mpg", FILE_TYPE_MUSIC},
+ {"audio/x-ms-asf", FILE_TYPE_MUSIC},
+ {"audio/x-wave", FILE_TYPE_MUSIC},
+ {"audio/x-flac", FILE_TYPE_MUSIC},
+ {"text/x-iMelody", FILE_TYPE_SOUND},
+ /*FILE_TYPE_PDF */
+ {"application/pdf", FILE_TYPE_PDF},
+
+ /*FILE_TYPE_DOC */
+ {"application/msword", FILE_TYPE_DOC},
+ {"application/vnd.openxmlformats-officedocument.wordprocessingml.document", FILE_TYPE_DOC},
+
+ /*FILE_TYPE_PPT */
+ {"application/vnd.ms-powerpoint", FILE_TYPE_PPT},
+ {"application/vnd.openxmlformats-officedocument.presentationml.presentation", FILE_TYPE_PPT},
+
+ /*FILE_TYPE_EXCEL */
+ {"application/vnd.ms-excel", FILE_TYPE_EXCEL},
+ {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", FILE_TYPE_EXCEL},
+
+ /*FILE_TYPE_VOICE */
+ {"audio/AMR", FILE_TYPE_VOICE},
+ {"audio/AMR-WB", FILE_TYPE_VOICE},
+ {"audio/amr", FILE_TYPE_VOICE},
+ {"audio/amr-wb", FILE_TYPE_VOICE},
+ {"audio/x-amr", FILE_TYPE_VOICE},
+
+ /*FILE_TYPE_HTML */
+ {"text/html", FILE_TYPE_HTML},
+ {"text/xml", FILE_TYPE_HTML},
+
+ /*FILE_TYPE_FLASH */
+ {"application/x-shockwave-flash", FILE_TYPE_FLASH},
+ {"video/x-flv", FILE_TYPE_FLASH},
+
+ /*FILE_TYPE_TXT */
+ {"text/plain", FILE_TYPE_GUL},
+ {"text/calendar", FILE_TYPE_VCALENDAR},
+
+ {"application/vnd.tizen.package", FILE_TYPE_TPK},
+ /*FILE_TYPE_RSS */
+ {"text/x-opml+xml", FILE_TYPE_RSS},
+
+ /*FILE_TYPE_JAVA */
+ {"text/vnd.sun.j2me.app-descriptor", FILE_TYPE_JAVA},
+ {"application/x-java-archive", FILE_TYPE_JAVA},
+
+ /* FILE_TYPE_VCONTACT */
+ {"text/directory", FILE_TYPE_VCONTACT},
+ {"text/x-vcard", FILE_TYPE_VCONTACT},
+ {"application/snb", FILE_TYPE_SNB},
+ {"application/x-hwp", FILE_TYPE_HWP},
+
+ /*FILE_TYPE_ETC */
+ {NULL, FILE_TYPE_ETC},
+};
+
+static char *icon_array[FILE_TYPE_MAX] = {
+ [FILE_TYPE_DIR] = MF_ICON_FOLDER,
+ [FILE_TYPE_IMAGE] = MF_ICON_IMAGE,
+ [FILE_TYPE_VIDEO] = MF_ICON_VIDEO,
+ [FILE_TYPE_MUSIC] = MF_ICON_MUSIC,
+ [FILE_TYPE_SOUND] = MF_ICON_MUSIC,
+ [FILE_TYPE_PDF] = MF_ICON_PDF,
+ [FILE_TYPE_DOC] = MF_ICON_DOC,
+ [FILE_TYPE_PPT] = MF_ICON_PPT,
+ [FILE_TYPE_EXCEL] = MF_ICON_EXCEL,
+ [FILE_TYPE_VOICE] = MF_ICON_SOUND,
+ [FILE_TYPE_HTML] = MF_ICON_HTML,
+ [FILE_TYPE_FLASH] = MF_ICON_FLASH,
+ [FILE_TYPE_TXT] = MF_ICON_TXT,
+ [FILE_TYPE_TPK] = MF_ICON_TPK,
+ [FILE_TYPE_VCONTACT] = MF_ICON_VCONTACT,
+ [FILE_TYPE_VCALENDAR] = MF_ICON_VCALENDAR,
+ [FILE_TYPE_VNOTE] = MF_ICON_VNOTE,
+ [FILE_TYPE_RSS] = MF_ICON_RSS,
+ [FILE_TYPE_JAVA] = MF_ICON_JAVA,
+ [FILE_TYPE_HWP] = MF_ICON_HWP,
+ [FILE_TYPE_SNB] = MF_ICON_SNB,
+ [FILE_TYPE_GUL] = MF_ICON_GUL,
+ [FILE_TYPE_TASK] = MF_ICON_TASK,
+ [FILE_TYPE_EML] = MF_ICON_EMAIL,
+ [FILE_TYPE_CSV] = MF_ICON_EXCEL,
+ [FILE_TYPE_SVG] = MF_ICON_SVG,
+ [FILE_TYPE_WGT] = MF_ICON_TPK,
+};
+
+/*********************
+**Function name: __mf_file_attr_get_category_by_file_ext
+**Parameter: const char *file_ext
+**Return value: fsFileType
+**
+**Action:
+** Get file category by extention
+**
+*********************/
+static fsFileType __mf_file_attr_get_category_by_file_ext(const char *file_ext, const char *fullpath)
+{
+ int i = 0;
+
+ if (file_ext == NULL)
+ return FILE_TYPE_ETC;
+
+ if (file_ext[0] == '.')
+ i = 1;
+
+ switch (file_ext[i]) {
+ case 'a':
+ case 'A':
+ if (strcasecmp("ASF", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("AMR", &file_ext[i]) == 0)
+ return FILE_TYPE_VOICE;
+
+ if (strcasecmp("AWB", &file_ext[i]) == 0)
+ return FILE_TYPE_VOICE;
+
+ if (strcasecmp("AAC", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("AVI", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("AAC", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ break;
+ case 'b':
+ case 'B':
+ if (strcasecmp("BMP", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ break;
+ case 'c':
+ case 'C':
+ if (strcasecmp("csv", &file_ext[i]) == 0)
+ return FILE_TYPE_CSV;
+
+ break;
+ case 'd':
+ case 'D':
+ if (strcasecmp("DOC", &file_ext[i]) == 0)
+ return FILE_TYPE_DOC;
+
+ if (strcasecmp("DOCX", &file_ext[i]) == 0)
+ return FILE_TYPE_DOC;
+
+ if (strcasecmp("DIVX", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ break;
+ case 'E':
+ case 'e':
+ if (strcasecmp("EML", &file_ext[i]) == 0)
+ return FILE_TYPE_EML;
+
+ break;
+ case 'f':
+ case 'F':
+ if (strcasecmp("FLAC", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ break;
+ case 'g':
+ case 'G':
+ if (strcasecmp("GIF", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("G72", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("GUL", &file_ext[i]) == 0)
+ return FILE_TYPE_GUL;
+
+ break;
+ case 'h':
+ case 'H':
+ if (strcasecmp("HTML", &file_ext[i]) == 0)
+ return FILE_TYPE_HTML;
+
+ if (strcasecmp("HTM", &file_ext[i]) == 0)
+ return FILE_TYPE_HTML;
+
+ if (strcasecmp("HWP", &file_ext[i]) == 0)
+ return FILE_TYPE_HWP;
+
+ break;
+ case 'i':
+ case 'I':
+ if (strcasecmp("IMY", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("IPK", &file_ext[i]) == 0)
+ return FILE_TYPE_APP;
+
+ if (strcasecmp("ICS", &file_ext[i]) == 0)
+ return FILE_TYPE_VCALENDAR;
+
+ break;
+ case 'j':
+ case 'J':
+ if (strcasecmp("JAD", &file_ext[i]) == 0)
+ return FILE_TYPE_JAVA;
+
+ if (strcasecmp("JAR", &file_ext[i]) == 0)
+ return FILE_TYPE_JAVA;
+
+ if (strcasecmp("JPG", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("JPEG", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("JPE", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("JP2", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ break;
+ case 'm':
+ case 'M':
+ if (strcasecmp("MMF", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("MP3", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("MID", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("MIDI", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("MP4", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("MPG", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("MPEG", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("M4A", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("M3G", &file_ext[i]) == 0)
+ return FILE_TYPE_FLASH;
+
+ if (strcasecmp("MXMF", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("MKV", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("MKA", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ break;
+ case 'o':
+ case 'O':
+ if (strcasecmp("opml", &file_ext[i]) == 0)
+ return FILE_TYPE_RSS;
+
+ if (strcasecmp("ogg", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ break;
+ case 'p':
+ case 'P':
+ if (strcasecmp("PNG", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("PJPEG", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("PDF", &file_ext[i]) == 0)
+ return FILE_TYPE_PDF;
+
+ if (strcasecmp("PPT", &file_ext[i]) == 0)
+ return FILE_TYPE_PPT;
+
+ if (strcasecmp("PPTX", &file_ext[i]) == 0)
+ return FILE_TYPE_PPT;
+
+ if (strcasecmp("PEM", &file_ext[i]) == 0)
+ return FILE_TYPE_CERTIFICATION;
+
+ break;
+ case 'r':
+ case 'R':
+ if (strcasecmp("RA", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ break;
+ case 's':
+ case 'S':
+ if (strcasecmp("SDP", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("SPM", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("SMP", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("SPF", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("SWF", &file_ext[i]) == 0)
+ return FILE_TYPE_FLASH;
+
+ if (strcasecmp("SCN", &file_ext[i]) == 0)
+ return FILE_TYPE_MOVIE_MAKER;
+
+ if (strcasecmp("SVG", &file_ext[i]) == 0)
+ return FILE_TYPE_SVG;
+
+ if (strcasecmp("SVGZ", &file_ext[i]) == 0)
+ return FILE_TYPE_SVG;
+
+ if (strcasecmp("SNB", &file_ext[i]) == 0)
+ return FILE_TYPE_SNB;
+
+ if (strcasecmp("SPD", &file_ext[i]) == 0)
+ return FILE_TYPE_SPD;
+
+ break;
+ case 't':
+ case 'T':
+ if (strcasecmp("TXT", &file_ext[i]) == 0)
+ return FILE_TYPE_TXT;
+
+ if (strcasecmp("THM", &file_ext[i]) == 0)
+ return FILE_TYPE_THEME;
+
+ if (strcasecmp("TPK", &file_ext[i]) == 0)
+ return FILE_TYPE_TPK;
+
+ if (strcasecmp("TIF", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ break;
+ case 'v':
+ case 'V':
+ if (strcasecmp("VCF", &file_ext[i]) == 0)
+ return FILE_TYPE_VCONTACT;
+
+ if (strcasecmp("VCS", &file_ext[i]) == 0)
+ return FILE_TYPE_VCALENDAR;
+
+ if (strcasecmp("VNT", &file_ext[i]) == 0)
+ return FILE_TYPE_VNOTE;
+
+ if (strcasecmp("VBM", &file_ext[i]) == 0)
+ return FILE_TYPE_VBOOKMARK;
+
+ if (strcasecmp("VTS", &file_ext[i]) == 0)
+ return FILE_TYPE_TASK;
+
+ break;
+ case 'w':
+ case 'W':
+ if (strcasecmp("WAV", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("WBMP", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ if (strcasecmp("WGT", &file_ext[i]) == 0)
+ return FILE_TYPE_WGT;
+
+ if (strcasecmp("WMA", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("WMV", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("WML", &file_ext[i]) == 0)
+ return FILE_TYPE_HTML;
+
+ if (strcasecmp("WAVE", &file_ext[i]) == 0)
+ return FILE_TYPE_MUSIC;
+
+ if (strcasecmp("WMF", &file_ext[i]) == 0)
+ return FILE_TYPE_IMAGE;
+
+ break;
+ case 'x':
+ case 'X':
+ if (strcasecmp("XLS", &file_ext[i]) == 0)
+ return FILE_TYPE_EXCEL;
+
+ if (strcasecmp("XLSX", &file_ext[i]) == 0)
+ return FILE_TYPE_EXCEL;
+
+ if (strcasecmp("XMF", &file_ext[i]) == 0)
+ return FILE_TYPE_SOUND;
+
+ if (strcasecmp("XHTML", &file_ext[i]) == 0)
+ return FILE_TYPE_HTML;
+
+ if (strcasecmp("XML", &file_ext[i]) == 0)
+ return FILE_TYPE_HTML;
+
+ break;
+ case '3':
+ if (strcasecmp("3GP", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("3GPP", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ if (strcasecmp("3G2", &file_ext[i]) == 0)
+ return FILE_TYPE_VIDEO;
+
+ break;
+ }
+
+ return FILE_TYPE_ETC;
+}
+
+/*********************
+**Function name: mf_get_category
+**Parameter:
+** const char *filepath: file fullpath
+** fsFileType *category: output parameter of category
+**Return value:
+** error code
+**
+**Action:
+** Get file category by file full path
+**
+*********************/
+int mf_file_attr_get_file_category(const char *filepath, fsFileType * category)
+{
+ int i = 0;
+ int flag = 0;
+
+ if (mf_file_attr_is_dir(filepath)) {
+ *category = FILE_TYPE_DIR;
+ return MYFILE_ERR_NONE;
+ }
+
+ const char *filename = NULL;
+ filename = mf_file_get(filepath);
+ if (filename == NULL) {
+ *category = FILE_TYPE_NONE;
+ return MYFILE_ERR_SRC_ARG_INVALID;
+ }
+ char *file_ext = NULL;
+ /*ToDo: error file name like the last letter is "." */
+ for (i = strlen(filename); i >= 0; i--) {
+ if (filename[i] == '.') {
+ file_ext = g_strdup(&filename[i + 1]);
+ flag = 1;
+ break;
+ }
+
+ if (filename[i] == '/') {
+ flag = 0;
+ break;
+ }
+ }
+
+ if (flag == 1) {
+ *category = __mf_file_attr_get_category_by_file_ext(file_ext, filepath);
+ SAFE_FREE_CHAR(file_ext);
+ return MYFILE_ERR_NONE;
+ } else {
+ *category = FILE_TYPE_NONE;
+ SAFE_FREE_CHAR(file_ext);
+ return MYFILE_ERR_GET_CATEGORY_FAIL;
+ }
+}
+
+/*********************
+**Function name: mf_file_attr_get_file_stat
+**Parameter:
+** const char *filename: file name
+** fsNodeInfo **node: output parameter of what we need to refine
+**Return value:
+** error code
+**
+**Action:
+** Get file size and last modified date by file path
+**
+*********************/
+int mf_file_attr_get_file_mdate(const char *filename, i18n_udate *date)
+{
+ struct stat statbuf;
+ if (stat(filename, &statbuf) == -1)
+ return MYFILE_ERR_GET_STAT_FAIL;
+
+ time_t tempdate = statbuf.st_mtime;
+ *date = (i18n_udate) tempdate * MF_UDATE_NUM;
+ return MYFILE_ERR_NONE;
+
+}
+
+int mf_file_attr_get_file_size(const char *filename, off_t *size)
+{
+ struct stat statbuf;
+ if (stat(filename, &statbuf) == -1)
+ return MYFILE_ERR_GET_STAT_FAIL;
+
+ *size = statbuf.st_size;
+ return MYFILE_ERR_NONE;
+
+}
+
+int mf_file_attr_get_file_stat(const char *filename, fsNodeInfo **node)
+{
+ struct stat statbuf;
+
+ if (stat(filename, &statbuf) == -1)
+ return MYFILE_ERR_GET_STAT_FAIL;
+
+ time_t tempdate = statbuf.st_mtime;
+ (*node)->size = statbuf.st_size;
+ (*node)->date = (i18n_udate) tempdate * MF_UDATE_NUM;
+
+ return MYFILE_ERR_NONE;
+}
+
+/*********************
+**Function name: mf_file_attr_is_dir
+**Parameter:
+** const char *filename: file fullpath
+**Return value:
+** if path is a directory, return 1
+** else, return 0
+**
+**Action:
+** check if the file path is Directory
+**
+*********************/
+int mf_file_attr_is_dir(const char *filepath)
+{
+ return mf_is_dir(filepath);
+}
+
+/*********************
+**Function name: mf_file_attr_get_store_type_by_full
+**Parameter:
+** const char *filepath: file full path
+** MF_STORAGE *store_type: output parameter of storage type
+**Return value:
+** error code
+**
+**Action:
+** Get file storage type by file path
+**
+*********************/
+int mf_file_attr_get_store_type_by_full(const char *filepath, MF_STORAGE * store_type)
+{
+ if (filepath == NULL || store_type == NULL)
+ return MYFILE_ERR_SRC_ARG_INVALID;
+
+ if (strncmp(filepath, PHONE_FOLDER, strlen(PHONE_FOLDER)) == 0) {
+ *store_type = MYFILE_PHONE;
+ return MYFILE_ERR_NONE;
+ } else if (strncmp(filepath, MEMORY_FOLDER, strlen(MEMORY_FOLDER)) == 0) {
+ *store_type = MYFILE_MMC;
+ return MYFILE_ERR_NONE;
+ } else {
+ *store_type = MYFILE_NONE;
+ return MYFILE_ERR_STORAGE_TYPE_ERROR;
+ }
+}
+
+
+/*********************
+**Function name: mf_file_attr_get_file_ext
+**Parameter:
+** const char *filepath: file full path
+** char *file_ext: output parameter of file extension
+**
+**Return value:
+** error code
+**
+**Action:
+** get file extension by file full path
+**
+*********************/
+int mf_file_attr_get_file_ext(const char *filepath, char **file_ext)
+{
+ assert(filepath);
+ assert(file_ext);
+ const char *filename = NULL;
+ filename = mf_file_get(filepath);
+
+ if (filename == NULL)
+ return MYFILE_ERR_INVALID_FILE_NAME;
+
+ char *pdot = strrchr(filename, '.');
+
+ if (!pdot) {
+ return MYFILE_ERR_EXT_GET_ERROR;
+ } else if (pdot != filepath) {
+ *file_ext = g_strdup(pdot + 1);
+ return MYFILE_ERR_NONE;
+ } else
+ return MYFILE_ERR_EXT_GET_ERROR;
+}
+
+/*********************
+**Function name: mf_file_attr_is_duplicated_name
+**Parameter:
+** const char *dir: dir which we need to check
+** const char *name: the file/dir name we need to check
+**
+**Return value:
+** -23 if the name is already existed
+** 0 if the name is not existed
+**
+**Action:
+** check if the name is existed in the specified dir
+**
+*********************/
+int mf_file_attr_is_duplicated_name(const char *dir, const char *name)
+{
+ char *file_path = g_strconcat(dir, "/", name, NULL);
+ if (file_path != NULL && mf_file_exists(file_path)) {
+ SAFE_FREE_CHAR(file_path);
+ return MYFILE_ERR_DUPLICATED_NAME;
+ } else {
+ SAFE_FREE_CHAR(file_path);
+ return MYFILE_ERR_NONE;
+ }
+}
+
+/*********************
+**Function name: mf_file_attr_is_valid_name
+**Parameter:
+** const char *filename: the file/dir name we need to check
+**
+**Return value:
+** -0x14 if the name is invalid
+** 0 if the name is valid
+**
+**Action:
+** check if the name is valid by file name
+**
+*********************/
+int mf_file_attr_is_valid_name(const char *filename)
+{
+ char *pattern;
+ int ret, z, cflags = 0;
+ char ebuf[128];
+ regex_t reg;
+ regmatch_t pm[1];
+ const size_t nmatch = 1;
+ /*ToDo: ignore the file star with . */
+#ifndef MYFILE_HIDEN_FILES_SHOW
+ if (strncmp(filename, ".", 1) == 0)
+ return MYFILE_ERR_INVALID_FILE_NAME;
+#endif
+
+ pattern = MYFILE_NAME_PATTERN;
+ z = regcomp(®, pattern, cflags);
+
+ if (z != 0) {
+ regerror(z, ®, ebuf, sizeof(ebuf));
+ fprintf(stderr, "%s: pattern '%s' \n", ebuf, pattern);
+ return MYFILE_ERR_INVALID_FILE_NAME;
+ }
+
+ z = regexec(®, filename, nmatch, pm, 0);
+ if (z == REG_NOMATCH)
+ ret = MYFILE_ERR_NONE;
+ else
+ ret = MYFILE_ERR_INVALID_FILE_NAME;
+
+ regfree(®);
+ return ret;
+}
+
+
+/*********************
+**Function name: mf_file_attr_is_right_dir_path
+**Parameter:
+** const char *filename: the file/dir name we need to check
+**
+**Return value:
+** error code
+**
+**Action:
+** check if the dir path is correct
+**
+*********************/
+int mf_file_attr_is_right_dir_path(const char *dir_path)
+{
+ int result = MYFILE_ERR_NONE;
+ int length = 0;
+
+ length = strlen(dir_path);
+ if (length == 0)
+ return MYFILE_ERR_INVALID_DIR_PATH;
+
+ if (dir_path[length - 1] == '/' && length > 1)
+ return MYFILE_ERR_INVALID_DIR_PATH;
+
+ if (dir_path[0] != '/')
+ return MYFILE_ERR_INVALID_DIR_PATH;
+
+ const char *file_name = NULL;
+ file_name = mf_file_get(dir_path);
+ result = mf_file_attr_is_valid_name(file_name);
+
+ if (result != MYFILE_ERR_NONE)
+ _ERR("Is NOT Valid dir path name");
+
+ return result;
+}
+
+
+/*********************
+**Function name: mf_file_attr_is_right_file_path
+**Parameter:
+** const char *filename: the file/dir name we need to check
+**
+**Return value:
+** error code
+**
+**Action:
+** check if the file path is correct
+**
+*********************/
+int mf_file_attr_is_right_file_path(const char *file_path)
+{
+ int result = MYFILE_ERR_NONE;
+
+ if (strlen(file_path) == 0)
+ return MYFILE_ERR_INVALID_FILE_PATH;
+
+ if (file_path[0] != '/')
+ return MYFILE_ERR_INVALID_DIR_PATH;
+
+ const char *file_name = NULL;
+ file_name = mf_file_get(file_path);
+ result = mf_file_attr_is_valid_name(file_name);
+
+ if (result != MYFILE_ERR_NONE)
+ _ERR("Is NOT Valid dir path name");
+
+ return result;
+}
+
+/*********************
+**Function name: mf_file_attr_is_right_dir_path
+**Parameter:
+** const char *filename: the file/dir name we need to check
+**
+**Return value:
+** error code
+**
+**Action:
+** check if the dir path is correct
+**
+*********************/
+int mf_file_attr_get_parent_path(const char *path, char **parent_path)
+{
+ assert(path);
+ assert(parent_path);
+
+ *parent_path = g_strdup(path);
+ if (*parent_path == NULL)
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+
+ const char *name = NULL;
+ name = mf_file_get(path);
+ /*
+ ** input path and parent_path are check in the caller.
+ ** parent_path is full path must be like /opt/media/file.ext
+ ** name is file.ext
+ ** strlen(parent_path) should large than strlen(name) normally.
+ ** to take exception like input path is "", we add a if condition
+ */
+ if (strlen(*parent_path) > strlen(name))
+ (*parent_path)[strlen(*parent_path) - strlen(name) - 1] = '\0';
+
+ if (strlen(*parent_path) == 0) {
+ free(*parent_path);
+ *parent_path = g_strdup("/");
+ }
+
+ return MYFILE_ERR_NONE;
+}
+
+/*********************
+**Function name: mf_file_attr_get_logical_path_by_full
+**Parameter:
+** const char *full_path: the full path
+** char *path: logic path of output parameter
+**
+**Return value:
+** error code
+**
+**Action:
+** get logic path by full path
+**
+*********************/
+int mf_file_attr_get_logical_path_by_full(const char *full_path, char **path)
+{
+ assert(full_path);
+ assert(path);
+ MF_STORAGE store_type = 0;
+ int root_len = 0;
+
+ int err = mf_file_attr_get_store_type_by_full(full_path, &store_type);
+ if (err != MYFILE_ERR_NONE) {
+ _ERR("get store type by path %s failed.", full_path);
+ return MYFILE_ERR_STORAGE_TYPE_ERROR;
+ }
+
+ *path = g_strdup(full_path);
+ if (*path == NULL)
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+
+ memset(*path, 0, strlen(*path));
+ switch (store_type) {
+ case MYFILE_PHONE:
+ root_len = strlen(PHONE_FOLDER);
+ break;
+ case MYFILE_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) {
+ SAFE_FREE_CHAR(*path);
+ *path = g_strdup("/");
+ }
+
+ return MYFILE_ERR_NONE;
+}
+
+
+typedef struct __mf_transfer_data_s mf_transfer_data_s;
+
+struct __mf_transfer_data_s {
+ const char *file_path;
+ char *thumb_path;
+ media_info_h *media;
+};
+/*
+static bool __mf_local_data_get_media_thumbnail_cb(media_info_h media, void *data)
+{
+// mf_retvm_if(data == NULL, -1, "filter is NULL");
+ mf_transfer_data_s *tmp_data = (mf_transfer_data_s *)data;
+
+
+ media_info_clone(tmp_data->media, media);
+ int retcode = media_info_get_thumbnail_path(media, &(tmp_data->thumb_path));
+ if (retcode != MEDIA_CONTENT_ERROR_NONE) {
+// mf_debug("Get media thumbnail path failed!![%d]", retcode);
+ }
+
+ return false;
+}
+*/
+int mf_file_attr_get_file_icon(const char *file_path, int *error_code, int view_type, char **thumbnail, media_info_h *media_info)
+{
+ int index = 0;
+ char *icon_path = g_strdup(DEFAULT_ICON);
+ fsFileType ftype = FILE_TYPE_NONE;
+ fsFileType ftype_by_mime = FILE_TYPE_NONE;
+ char *mime = NULL;
+ int thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT;
+ int retcode = -1;
+ char *ext = NULL;
+
+ if (file_path == NULL) {
+ _ERR("file_path is NULL");
+ return thumbnail_type;
+ }
+
+ int ret = mf_file_attr_get_file_category(file_path, &ftype);
+ ftype_by_mime = ftype;
+ if (ret != MYFILE_ERR_NONE || ftype == FILE_TYPE_NONE || ftype == FILE_TYPE_ETC) {
+ int err_code = mf_file_attr_get_file_ext(file_path, &ext);
+ if (err_code != MYFILE_ERR_NONE || ext == NULL) {
+ _ERR("Fail to get file extension");
+ return thumbnail_type;
+ }
+ retcode = mime_type_get_mime_type(ext, &mime);
+ if ((mime == NULL) || (retcode != MIME_TYPE_ERROR_NONE)) {
+ _ERR("Fail to get mime type, set etc icon");
+ SAFE_FREE_CHAR(ext);
+ return thumbnail_type;
+ }
+
+ for (index = 0; mime_type[index].mime; index++) {
+ if (strncmp(mime, mime_type[index].mime, strlen(mime)) == 0) {
+ ftype_by_mime = mime_type[index].ftype;
+ break;
+ }
+ }
+ }
+
+ ftype = ftype_by_mime;
+
+ SAFE_FREE_CHAR(icon_path);
+ SAFE_FREE_CHAR(ext);
+
+ switch (ftype) {
+ case FILE_TYPE_IMAGE:
+ case FILE_TYPE_VIDEO:
+ case FILE_TYPE_MUSIC:
+ case FILE_TYPE_SOUND: {
+ thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT;
+ /*int err = 0;
+ mf_transfer_data_s tmp_data;
+ memset(&tmp_data, 0x00, sizeof(mf_transfer_data_s));
+ tmp_data.file_path = file_path;
+ tmp_data.media = media_info;
+ //err = mf_file_attr_get_thumbnail(&tmp_data);
+ char *condition = NULL;
+ condition = g_strdup_printf("%s and MEDIA_PATH=\"%s\"", MF_CONDITION_IMAGE_VIDEO, tmp_data.file_path);
+ err = mf_media_content_data_get(&tmp_data, condition, __mf_local_data_get_media_thumbnail_cb);
+ if (err == 0) {
+ if (tmp_data.thumb_path && mf_file_exists(tmp_data.thumb_path)) {
+ SAFE_FREE_CHAR(icon_path);
+ icon_path = g_strdup(tmp_data.thumb_path);
+ thumbnail_type = MF_THUMBNAIL_TYPE_THUMBNAIL;
+ } else {
+ icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype));
+ thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT;
+ *error_code = 1;
+ }
+ } else {
+ if (error_code) {
+ *error_code = err;
+ }
+
+ icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype));
+ thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT;
+ }
+ SAFE_FREE_CHAR(tmp_data.thumb_path);*/
+ }
+ break;
+ default:
+ icon_path = g_strdup(mf_file_attr_get_default_icon_by_type(ftype));
+ thumbnail_type = MF_THUMBNAIL_TYPE_DEFAULT;
+ break;
+ }
+
+ *thumbnail = icon_path;
+ SAFE_FREE_CHAR(mime);
+ return thumbnail_type;
+}
+
+fsFileType mf_file_attr_get_file_type(const char *mime)
+{
+ int index;
+ fsFileType ftype = FILE_TYPE_NONE;
+ for (index = 0; mime_type[index].mime; index++) {
+ if (strncmp(mime, mime_type[index].mime, strlen(mime)) == 0)
+ ftype = mime_type[index].ftype;
+ }
+ return ftype;
+
+}
+
+fsFileType mf_file_attr_get_file_type_by_mime(const char *file_path)
+{
+ int index;
+ fsFileType ftype = FILE_TYPE_NONE;
+ char *mime = NULL;
+ int retcode = -1;
+
+ if (!file_path)
+ return ftype;
+
+ char *ext = NULL;
+ int error_code = mf_file_attr_get_file_ext(file_path, &ext);
+ if (error_code != MYFILE_ERR_NONE || ext == NULL) {
+ _ERR("Fail to get file extension");
+ return ftype;
+ }
+
+ retcode = mime_type_get_mime_type(ext, &mime);
+ if ((mime == NULL) || (retcode != MIME_TYPE_ERROR_NONE)) {
+ _ERR("Fail to get mime type, set etc icon");
+ SAFE_FREE_CHAR(ext);
+ return ftype;
+ }
+
+ for (index = 0; mime_type[index].mime; index++) {
+ if (strncmp(mime, mime_type[index].mime, strlen(mime)) == 0) {
+ ftype = mime_type[index].ftype;
+ SAFE_FREE_CHAR(mime);
+ SAFE_FREE_CHAR(ext);
+ return ftype;
+ }
+ }
+
+ _ERR("No matched mimetype(%s) for file: %s", mime, file_path);
+ SAFE_FREE_CHAR(mime);
+ SAFE_FREE_CHAR(ext);
+ return ftype;
+}
+
+const char *mf_file_attr_get_default_icon_by_type(fsFileType ftype)
+{
+ const char *icon_path = DEFAULT_ICON;
+
+ if (icon_array[ftype])
+ icon_path = icon_array[ftype];
+ else
+ icon_path = DEFAULT_ICON;
+
+ return icon_path;
+}
+
+/*********************
+**Function name: mf_file_attr_get_path_level
+**Parameter:
+** const char *file_fullpath: the full path
+** int* level: level which the specified path under(this is output parameter)
+**
+**Return value:
+** error code
+**
+**Action:
+** get level of specified path under
+**
+*********************/
+int mf_file_attr_get_path_level(const char *fullpath, int *level)
+{
+ if (fullpath == NULL)
+ return MYFILE_ERR_SRC_ARG_INVALID;
+
+ if (mf_file_attr_is_right_dir_path(fullpath) != 0)
+ return MYFILE_ERR_INVALID_PATH;
+
+ MF_STORAGE storage_t = 0;
+ int start_level = 0;
+ int error_code = mf_file_attr_get_store_type_by_full(fullpath, &storage_t);
+
+ if (error_code != 0)
+ return error_code;
+
+ if (storage_t == MYFILE_PHONE)
+ start_level = MF_PHONE_DEFAULT_LEVEL;
+ else if (storage_t == MYFILE_MMC)
+ start_level = MF_MMC_DEFAULT_LEVEL;
+
+ char *temp = strdup(fullpath);
+
+ if (temp == NULL)
+ return MYFILE_ERR_UNKNOWN_ERROR;
+
+ int count = 0;
+
+ gchar **result = NULL;
+ gchar **params = NULL;
+ result = g_strsplit(temp, "/", 0);
+ if (result == NULL) {
+ free(temp);
+ temp = NULL;
+ return MYFILE_ERR_UNKNOWN_ERROR;
+ }
+ for (params = result; *params; params++)
+ count++;
+
+ g_strfreev(result);
+ *level = count - start_level - 1;
+ free(temp);
+ return MYFILE_ERR_NONE;
+
+}
+
+/*********************
+**Function name: mf_file_attr_is_in_system_folder
+**Parameter:
+** const char *file_fullpath: the full path
+** int* level: level which the specified path under
+** bool* result: output parameter for the result
+**
+**Return value:
+** error code
+**
+**Action:
+** check if the specified path is under system folder
+**
+*********************/
+int mf_file_attr_is_in_system_folder(char *fullpath, int level, bool * result)
+{
+ if (fullpath == NULL)
+ return MYFILE_ERR_SRC_ARG_INVALID;
+
+ MF_STORAGE storage_t = 0;
+ int error_code = mf_file_attr_get_store_type_by_full(fullpath, &storage_t);
+
+ if (error_code != 0)
+ return error_code;
+
+ const char *name = NULL;
+ name = mf_file_get(fullpath);
+ char *parent_path = NULL;
+ error_code = mf_file_attr_get_parent_path(fullpath, &parent_path);
+
+ if (error_code != 0)
+ return error_code;
+
+ if (storage_t == MYFILE_PHONE || storage_t == MYFILE_MMC) {
+ if (level == 1) {
+ if ((strlen(name) == strlen(DEFAULT_FOLDER_CAMERA_SHOTS)) && strcmp(name, DEFAULT_FOLDER_CAMERA_SHOTS) == 0)
+ *result = true;
+ else if ((strlen(name) == strlen(DEFAULT_FOLDER_IMAGE)) && strcmp(name, DEFAULT_FOLDER_IMAGE) == 0)
+ *result = true;
+ else if ((strlen(name) == strlen(DEFAULT_FOLDER_VIDEO)) && strcmp(name, DEFAULT_FOLDER_VIDEO) == 0)
+ *result = true;
+ else if ((strlen(name) == strlen(DEFAULT_FOLDER_MUSIC)) && strcmp(name, DEFAULT_FOLDER_MUSIC) == 0)
+ *result = true;
+ else if ((strlen(name) == strlen(DEFAULT_FOLDER_DOWNLOADS)) && strcmp(name, DEFAULT_FOLDER_DOWNLOADS) == 0)
+ *result = true;
+ else {
+ *result = false;
+ /*if (storage_t == MYFILE_PHONE) {
+ if ((strlen(name) == strlen(DEFAULT_FOLDER_ALERTS_AND_RINGTONES)) && strcmp(name, DEFAULT_FOLDER_ALERTS_AND_RINGTONES) == 0) {
+ *result = true;
+ } else if ((strlen(name) == strlen(DEFAULT_FOLDER_BOOKMARK)) && strcmp(name, DEFAULT_FOLDER_BOOKMARK) == 0) {
+ *result = true;
+ } else if ((strlen(name) == strlen(DEFAULT_FOLDER_RSS)) && strcmp(name, DEFAULT_FOLDER_RSS) == 0) {
+ *result = true;
+ } else {
+ *result = false;
+ }
+ } else {
+ *result = false;
+ }*/
+ }
+ } else if (level == 2) {
+ const char *parent_name = NULL;
+ parent_name = mf_file_get(parent_path);
+ if (storage_t == MYFILE_PHONE) {
+ if (!g_strcmp0(parent_name, DEFAULT_FOLDER_IMAGE) /*&& !g_strcmp0(name, SUB_FODER_WALLPAPER)*/) {
+ *result = true;
+ /*} else if (!g_strcmp0(parent_name, DEFAULT_FOLDER_ALERTS_AND_RINGTONES)
+ && (!g_strcmp0(name, SUB_FODER_ALERTS) || !g_strcmp0(name, SUB_FODER_RINGTONES))) {
+ *result = true;
+ } else if (!g_strcmp0(parent_name, DEFAULT_FOLDER_MUSIC)
+ && (!g_strcmp0(name, SUB_FODER_FM) || !g_strcmp0(name, SUB_FODER_VOICE_RECORD))) {
+ *result = true;*/
+ } else
+ *result = false;
+ } else
+ *result = false;
+ } else {
+ if (parent_path) {
+ free(parent_path);
+ parent_path = NULL;
+ }
+ return MYFILE_ERR_STORAGE_TYPE_ERROR;
+ }
+ }
+
+ else {
+ if (parent_path) {
+ free(parent_path);
+ parent_path = NULL;
+ }
+ *result = false;
+ return MYFILE_ERR_STORAGE_TYPE_ERROR;
+ }
+ if (parent_path) {
+ free(parent_path);
+ parent_path = NULL;
+ }
+ return MYFILE_ERR_NONE;
+}
+
+/*********************
+**Function name: mf_file_attr_is_system_dir
+**Parameter:
+** const char *file_fullpath: the full path
+** bool* result: output parameter for the result
+**
+**Return value:
+** error code
+**
+**Action:
+** check if the specified path is system folder
+**
+*********************/
+int mf_file_attr_is_system_dir(char *fullpath, bool * result)
+{
+ if (fullpath == NULL) {
+ _ERR("source argument invalid");
+ return MYFILE_ERR_SRC_ARG_INVALID;
+ }
+
+ if (mf_file_attr_is_dir(fullpath) == 0) {
+ _ERR("source is not exist");
+ return MYFILE_ERR_SRC_NOT_EXIST;
+ }
+
+ int level = 0;
+ int error_code = 0;
+
+ error_code = mf_file_attr_get_path_level(fullpath, &level);
+ if (error_code != 0) {
+ _ERR("Fail to get path level");
+ return error_code;
+ }
+
+ if (level >= 3 || level <= 0) {
+ *result = false;
+ _ERR("Path Level is wrong");
+ return MYFILE_ERR_NONE;
+ }
+ error_code = mf_file_attr_is_in_system_folder(fullpath, level, result);
+
+ if (error_code != 0) {
+ _ERR("Fail .. is in system folder err :: %d", error_code);
+ return error_code;
+ }
+
+ return MYFILE_ERR_NONE;
+}
+
+void mf_file_attr_get_file_size_info(char **file_size, off_t src_size)
+{
+ if (file_size == NULL) {
+ _ERR("file_size is NULL");
+ return;
+ }
+
+ unsigned long long original_size = 0;
+ double size = 0;
+ int index = 0;
+ int len = 0;
+
+ original_size = src_size;
+ size = (double)original_size;
+
+ while (size >= MYFILE_BASIC_SIZE) {
+ size /= MYFILE_BASIC_SIZE;
+ index++;
+ }
+
+ if (index == SIZE_BYTE)
+ snprintf(NULL, 0, "%llu B%n", original_size, &len);
+ else {
+ size = MF_ROUND_D(size, 1);
+ snprintf(NULL, 0, "%0.1lf XB%n", size, &len);
+ }
+
+ if (len <= 0) {
+ *file_size = NULL;
+ return;
+ }
+ len += 1;
+ *file_size = (char *)calloc(len, sizeof(char));
+ if (*file_size == NULL)
+ return;
+
+ if (index == SIZE_BYTE)
+ snprintf(*file_size, len, "%llu B", original_size);
+ else {
+ if (index == SIZE_KB)
+ snprintf(*file_size, len, "%0.1lf KB", size);
+ else if (index == SIZE_MB)
+ snprintf(*file_size, len, "%0.1lf MB", size);
+ else if (index == SIZE_GB)
+ snprintf(*file_size, len, "%0.1lf GB", size);
+ else {
+ free(*file_size);
+ *file_size = NULL;
+ }
+ }
+
+ return;
+}
+
+
+int mf_file_attr_media_has_video(const char *filename)
+{
+ int ret = 0;
+ metadata_extractor_h handle = NULL;
+ char *value = NULL;
+
+ if (!filename)
+ goto CATCH_ERROR;
+
+ ret = metadata_extractor_create(&handle);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ _ERR("metadata_extractor_create().. %d", ret);
+ goto CATCH_ERROR;
+ }
+
+ ret = metadata_extractor_set_path(handle, filename);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ _ERR("metadata_extractor_set_path().. %d", ret);
+ goto CATCH_ERROR;
+ }
+
+ ret = metadata_extractor_get_metadata(handle, METADATA_HAS_VIDEO, &value);
+ if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) {
+ if (g_strcmp0(value, "1") == 0) {
+ _ERR("ret is [%d] value is [%s]", ret, "1");
+ if (handle)
+ metadata_extractor_destroy(handle);
+
+ SAFE_FREE_CHAR(value);
+ return 1;
+ }
+ SAFE_FREE_CHAR(value);
+ }
+
+ _ERR("ret is [%d] value is [%s]", ret, value);
+ SAFE_FREE_CHAR(value);
+
+ if (handle)
+ metadata_extractor_destroy(handle);
+
+ return 0;
+CATCH_ERROR:
+ if (handle)
+ metadata_extractor_destroy(handle);
+
+ return 0;
+}
+
+
+bool __mf_add_storage_info_to_list(media_storage_h storage, void *data)
+{
+ list_data_s *list_data;
+ list_data = data;
+
+ char *path = NULL;
+ int ret = 0;
+
+ path = list_data->path;
+
+ ret = mf_fs_oper_read_dir(path, &list_data->folder_list, &list_data->file_list);
+ if (ret != MYFILE_ERR_NONE) {
+ free(path);
+ return false;
+ }
+
+ list_data->file_count = eina_list_count(list_data->file_list);
+ list_data->folder_count = eina_list_count(list_data->folder_list);
+
+ char *storage_name = NULL;
+ char *storage_uuid = NULL;
+ char *base_dir = NULL;
+
+ media_content_storage_e storage_type;
+ media_storage_get_type(storage, &storage_type);
+
+ media_storage_get_id(storage, &storage_uuid);
+ media_storage_get_name(storage, &storage_name);
+ media_storage_get_path(storage, &base_dir);
+
+ _DBG("storage_uuid : %s, storage_name : %s, base_dir : %s", storage_uuid, storage_name, base_dir);
+
+ return true;
+}
--- /dev/null
+/*
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#include <errno.h>
+#include <app_debug.h>
+#include <string.h>
+
+#include "util/fs-error.h"
+
+int mf_error_erron_to_mferror(int err_no)
+{
+ int err = MYFILE_ERR_NONE;
+ char buf[256] = {0,};
+ char *str = (char *)strerror_r(err_no, buf, 256);
+
+ _ERR("err_no is [%d] error - %s", err_no, str);
+ switch (err_no) {
+#ifdef EINVAL
+ case EINVAL:
+ err = MYFILE_ERR_SRC_ARG_INVALID;
+ break;
+#endif
+
+#ifdef EACCES /*The requested access to the file is not allowed*/
+ case EACCES: /*report*/
+ err = MYFILE_ERR_PERMISSION_DENY;
+ break;
+#endif
+
+#ifdef EPERM
+ case EPERM:
+ err = MYFILE_ERR_PERMISSION_DENY;
+ break;
+#endif
+
+#ifdef EFAULT /* pathname points outside your accessible address space*/
+ case EFAULT:
+ err = MYFILE_ERR_FAULT;
+ break;
+#endif
+#ifdef ENOSPC /*pathname was to be created but the device containing pathname has no room for the new file*/
+ case ENOSPC: /*report*/
+ err = MYFILE_ERR_NO_FREE_SPACE;
+ break;
+#endif
+
+#ifdef EROFS /*pathname refers to a file on a read-only filesystem and write access was requested*/
+ case EROFS: /*report*/
+ err = MYFILE_ERR_READ_ONLY;
+ break;
+#endif
+
+ }
+ return err;
+}
+
--- /dev/null
+/*
+* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+#include <app_debug.h>
+#include "util/file-util.h"
+
+#define PATH_MAX_SIZE 256
+#define BUF_MAX 16384
+static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+
+const char *mf_file_get(const char path[])
+{
+ char *file = NULL;
+ if ((file = strrchr(path, '/')))
+ file++;
+ else
+ file = (char *) path;
+
+ return file;
+}
+
+char *mf_dir_get(const char path[])
+{
+ char *p = NULL;
+ char buf[PATH_MAX + 1] = {0,};
+
+ strncpy(buf, path, PATH_MAX);
+ p = strrchr(buf, '/');
+ if (!p)
+ return strdup(path);
+
+ if (p == buf)
+ return strdup("/");
+
+ *p = 0;
+ return strdup(buf);
+}
+
+int mf_file_exists(const char *path)
+{
+ struct stat info = {0,};
+
+ if (stat(path, &info) == 0)
+ return 1;
+ else
+ return 0;
+}
+
+Eina_Bool mf_is_dir(const char *path)
+{
+ if (!path)
+ return 0;
+
+ struct stat info = {0,};
+
+ if (stat(path, &info) == 0) {
+ if (S_ISDIR(info.st_mode))
+ return 1;
+ }
+
+ return 0;
+}
+
+int mf_is_dir_empty(const char *path)
+{
+ struct stat info = {0,};
+ struct dirent ent_struct;
+ struct dirent *dp = NULL;
+ DIR *dirp = NULL;
+
+ dirp = opendir(path);
+ if (!dirp)
+ return -1;
+
+ while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) {
+ if (stat(dp->d_name, &info) == 0 && (strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) {
+ closedir(dirp);
+ return 0;
+ }
+ }
+ closedir(dirp);
+ return 1;
+}
+
+int mf_mkdir(const char *dir)
+{
+ if (mkdir(dir, default_mode) < 0)
+ return 0;
+ else
+ return 1;
+}
+
+static int
+mf_mkpath_if_not_exists(const char *path)
+{
+ struct stat st = {0,};
+ if (stat(path, &st) < 0)
+ return mf_mkdir(path);
+ else if (!S_ISDIR(st.st_mode))
+ return 0;
+ else
+ return 1;
+}
+
+int mf_mkpath(const char *path)
+{
+ char ss[PATH_MAX] = {0,};
+ unsigned int i = 0;
+
+ if (mf_is_dir(path))
+ return 1;
+
+ for (i = 0; path[i] != '\0'; ss[i] = path[i], i++) {
+ if (i == sizeof(ss) - 1)
+ return 0;
+
+ if ((path[i] == '/') && (i > 0)) {
+ ss[i] = '\0';
+ if (!mf_mkpath_if_not_exists(ss))
+ return 0;
+ }
+ }
+ ss[i] = '\0';
+
+ return mf_mkpath_if_not_exists(ss);
+}
+
+char *mf_strip_ext(const char *path)
+{
+ char *p = NULL;
+ char *file = NULL;
+
+ p = strrchr(path, '.');
+ if (!p)
+ file = strdup(path);
+ else if (p != path) {
+ file = malloc(((p - path) + 1) * sizeof(char));
+ if (file) {
+ memcpy(file, path, (p - path));
+ file[p - path] = 0;
+ }
+ }
+
+ return file;
+}
+
+int mf_file_unlink(const char *filename)
+{
+ int status = unlink(filename);
+ if (status < 0)
+ return 0;
+ else
+ return 1;
+}
+
+int mf_file_size(const char *filename)
+{
+ struct stat info = {0,};
+ if (stat(filename, &info) == 0) {
+ if (!S_ISDIR(info.st_mode))
+ return info.st_size;
+ }
+
+ return 0;
+}
+
+int mf_file_rmdir(const char *filename)
+{
+ int status = rmdir(filename);
+ if (status < 0)
+ return 0;
+ else
+ return 1;
+}
+
+Eina_List *mf_file_ls(const char *dir)
+{
+ char *f;
+ DIR *dirp = NULL;
+ struct dirent ent_struct;
+ struct dirent *dp = NULL;
+ Eina_List *list = NULL;
+
+ dirp = opendir(dir);
+ if (!dirp)
+ return NULL;
+
+ while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) {
+ if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name , ".."))) {
+ f = strdup(dp->d_name);
+ list = eina_list_append(list, f);
+ }
+ }
+ closedir(dirp);
+
+ list = eina_list_sort(list, eina_list_count(list), EINA_COMPARE_CB(strcoll));
+
+ return list;
+}
+
+int mf_file_recursive_rm(const char *dir)
+{
+ char buf[PATH_MAX_SIZE] = {0,};
+ struct dirent ent_struct;
+ struct dirent *dp = NULL;
+ DIR *dirp = NULL;
+
+ if (readlink(dir, buf, sizeof(buf)) > 0)
+ return mf_file_unlink(dir);
+
+ int ret = mf_is_dir(dir);
+ if (ret) {
+ ret = 1;
+ dirp = opendir(dir);
+ if (dirp) {
+ while ((readdir_r(dirp, &ent_struct, &dp) == 0) && dp) {
+ if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name, ".."))) {
+ if (!mf_file_recursive_rm(dp->d_name))
+ ret = 0;
+ }
+ }
+ closedir(dirp);
+ }
+
+ if (!mf_file_rmdir(dir))
+ ret = 0;
+
+ return ret;
+ } else
+ return mf_file_unlink(dir);
+}
+
+int mf_file_cp(const char *src, const char *dst)
+{
+ FILE *f1 = NULL;
+ FILE *f2 = NULL;
+ char buf[BUF_MAX] = {0,};
+ char realpath1[PATH_MAX_SIZE] = {0,};
+ char realpath2[PATH_MAX_SIZE] = {0,};
+ size_t num;
+ int ret = 1;
+
+ if (!realpath(src, realpath1))
+ return 0;
+
+ if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2))
+ return 0;
+
+ f1 = fopen(src, "rb");
+ if (!f1)
+ return 0;
+
+ f2 = fopen(dst, "wb");
+ if (!f2) {
+ fclose(f1);
+ return 0;
+ }
+
+ while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) {
+ if (fwrite(buf, 1, num, f2) != num)
+ ret = 0;
+ }
+
+ fclose(f1);
+ fclose(f2);
+
+ return ret;
+}
+
+int mf_file_mv(const char *src, const char *dst)
+{
+ struct stat info = {0,};
+ if (stat(dst, &info) == 0)
+ return 0;
+
+ if (rename(src, dst)) {
+ memset(&info, 0x00, sizeof(struct stat));
+ if (stat(src, &info) == 0) {
+ if (S_ISREG(info.st_mode)) {
+ mf_file_cp(src, dst);
+ if (chmod(dst, info.st_mode) < 0)
+ _DBG("failed to set attributes");
+ if (unlink(src) < 0)
+ _DBG("failed to delete source");
+ return 1;
+ }
+ }
+ return 0;
+ }
+ return 1;
+}
+
+int mf_remove(const char *filename)
+{
+ int status = remove(filename);
+ if (status < 0)
+ return 0;
+ else
+ return 1;
+}
--- /dev/null
+#include <glib.h>
+#include <app_debug.h>
+
+#include "util/fs-util.h"
+#include "util/fs-error.h"
+#include "util/file-util.h"
+
+#define DEBUG_FOLDER "SLP_debug"
+
+/*********************
+**Function name: __mf_fm_svc_wrapper_COMESFROM
+**Parameter:
+** GString* fullpath: fullpath to check the location
+**
+**Return value:
+** location of the path
+**
+**Action:
+** get storage type by fullpath
+*********************/
+static int __mf_fm_svc_wrapper_COMESFROM(const char *fullpath)
+{
+ int len_phone = strlen(PHONE_FOLDER);
+ int len_memory = strlen(MEMORY_FOLDER);
+
+ if (strncmp(fullpath, PHONE_FOLDER, len_phone) == 0)
+ return MYFILE_PHONE;
+ else if (strncmp(fullpath, MEMORY_FOLDER, len_memory) == 0)
+ return MYFILE_MMC;
+ else
+ return MYFILE_ERR_STORAGE_TYPE_ERROR;
+}
+
+int mf_fm_svc_wrapper_get_location(const char *fullpath)
+{
+ return __mf_fm_svc_wrapper_COMESFROM(fullpath);
+}
+
+/*********************
+**Function name: mf_fs_oper_get_file
+**Parameter:
+** const char *path: full path to get file name
+**
+**Return value:
+** const char*: file name
+**
+**Action:
+** get file name from full path
+**
+*********************/
+static const char *mf_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;
+}
+
+
+/*********************
+**Function name: mf_fs_oper_error
+**Parameter:
+** const char *src: source path
+** const char *dst: destination path
+** int check_option: check option
+**
+**Return value:
+** error code
+**
+**Action:
+** input parameter checking
+**
+*********************/
+int mf_fs_oper_error(const char *src, const char *dst, int check_option)
+{
+ if ((check_option & MF_ERROR_CHECK_SRC_ARG_VALID) && (src == NULL))
+ return MYFILE_ERR_SRC_ARG_INVALID;
+
+ if ((check_option & MF_ERROR_CHECK_DST_ARG_VALID) && (dst == NULL))
+ return MYFILE_ERR_DST_ARG_INVALID;
+
+
+ if ((check_option & MF_ERROR_CHECK_SRC_EXIST) && (!mf_file_exists(src)))
+ return MYFILE_ERR_SRC_NOT_EXIST;
+
+ if ((check_option & MF_ERROR_CHECK_DST_EXIST) && (!mf_file_exists(dst)))
+ return MYFILE_ERR_DST_NOT_EXIST;
+
+
+ if (check_option & MF_ERROR_CHECK_SRC_PATH_VALID) {
+ if (!mf_is_dir(src)) {
+ if (mf_file_attr_is_right_file_path(src))
+ return MYFILE_ERR_INVALID_FILE_PATH;
+ } else {
+ if (mf_file_attr_is_right_dir_path(src))
+ return MYFILE_ERR_INVALID_DIR_PATH;
+ }
+ }
+ if (check_option & MF_ERROR_CHECK_DST_PATH_VALID) {
+ if (!mf_is_dir(dst)) {
+ int ret = mf_file_attr_is_right_file_path(dst);
+ if (ret != 0)
+ return ret;
+ } else {
+ int ret = mf_file_attr_is_right_dir_path(dst);
+ if (ret != 0)
+ return ret;
+ }
+ }
+
+ if (check_option & MF_ERROR_CHECK_SRC_PARENT_DIR_EXIST) {
+ char *parent_path = NULL;
+ if (mf_file_attr_get_parent_path(src, &parent_path)) {
+ if (!mf_file_exists(parent_path)) {
+ SAFE_FREE_CHAR(parent_path);
+ return MYFILE_ERR_DIR_NOT_FOUND;
+ }
+ }
+ SAFE_FREE_CHAR(parent_path);
+ }
+
+ if (check_option & MF_ERROR_CHECK_DST_PARENT_DIR_EXIST) {
+ char *parent_path = NULL;
+ if (mf_file_attr_get_parent_path(dst, &parent_path)) {
+ if (!mf_file_exists(parent_path)) {
+ SAFE_FREE_CHAR(parent_path);
+ return MYFILE_ERR_DIR_NOT_FOUND;
+ }
+ }
+ SAFE_FREE_CHAR(parent_path);
+ }
+
+ if (check_option & MF_ERROR_CHECK_DUPLICATED) {
+ char *parent_path = NULL;
+
+ if (!mf_file_attr_get_parent_path(dst, &parent_path)) {
+ if (mf_file_attr_is_duplicated_name(parent_path, mf_fs_oper_get_file(dst))) {
+ SAFE_FREE_CHAR(parent_path);
+ return MYFILE_ERR_DUPLICATED_NAME;
+ }
+ SAFE_FREE_CHAR(parent_path);
+ } else {
+ SAFE_FREE_CHAR(parent_path);
+ return MYFILE_ERR_GET_PARENT_PATH_FAIL;
+ }
+ }
+
+ return MYFILE_ERR_NONE;
+}
+
+/*********************
+**Function name: mf_fs_oper_read_dir
+**Parameter:
+** char *path: path which we need to read
+** Eina_List** dir_list: output parameter of dir list under specified path
+** Eina_List** file_list: output parameter of file list under specified path
+**
+**Return value:
+** error code
+**
+**Action:
+** read element under the specified path
+**
+*********************/
+int mf_fs_oper_read_dir(const char *path, Eina_List ** dir_list, Eina_List ** file_list)
+{
+ DIR *pDir = NULL;
+ struct dirent ent_struct;
+ struct dirent *ent;
+
+ if (path == NULL) {
+ _ERR("path is null");
+ return MYFILE_ERR_INVALID_ARG;
+ }
+
+ if (dir_list == NULL) {
+ _ERR("dir_list is null");
+ return MYFILE_ERR_INVALID_ARG;
+ }
+
+ if (file_list == NULL) {
+ _ERR("file_list is null");
+ return MYFILE_ERR_INVALID_ARG;
+ }
+
+ int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_SRC_EXIST | MF_ERROR_CHECK_SRC_PATH_VALID;
+ int storage_type = mf_fm_svc_wrapper_get_location(path);
+ int ret = mf_fs_oper_error(path, NULL, option);
+ if (ret != MYFILE_ERR_NONE)
+ return ret;
+
+ pDir = opendir(path);
+
+ if (pDir == NULL)
+ return MYFILE_ERR_DIR_OPEN_FAIL;
+
+ while ((readdir_r(pDir, &ent_struct, &ent) == 0) && ent) {
+ GString *childpath = NULL;
+ fsNodeInfo *pNode = NULL;
+
+ int len = strlen(ent->d_name);
+ if ((len == 1 && strncmp(ent->d_name, ".", strlen(".")) == 0) || (len == 2 && strncmp(ent->d_name, "..", strlen("..")) == 0))
+ continue;
+
+ /*int hiden_state = 0;
+ mf_util_get_pref_value(PREF_TYPE_HIDEN_STATE, &hiden_state);
+ if (hiden_state == MF_HIDEN_HIDE) {
+ if (strncmp(ent->d_name, ".", strlen(".")) == 0 || strncmp(ent->d_name, "..", strlen("..")) == 0) {
+ continue;
+ }
+ }*/
+
+ if ((ent->d_type & DT_DIR) == 0 && (ent->d_type & DT_REG) == 0)
+ continue;
+
+ if ((ent->d_type & DT_DIR) != 0) {
+ if ((strlen(path) == strlen(PHONE_FOLDER)) && (strcmp(path, PHONE_FOLDER) == 0)
+ && (strlen(ent->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(ent->d_name, DEBUG_FOLDER) == 0))
+ continue;
+ }
+
+ pNode = (fsNodeInfo *) malloc(sizeof(fsNodeInfo));
+
+ if (pNode == NULL)
+ continue;
+
+ memset(pNode, 0, sizeof(fsNodeInfo));
+
+ pNode->path = g_strdup(path);
+ pNode->name = g_strdup(ent->d_name);
+ pNode->storage_type = storage_type;
+ pNode->list_type = mf_list_normal;
+
+ if (ent->d_type & DT_DIR)
+ pNode->type = FILE_TYPE_DIR;
+ else if (ent->d_type & DT_REG)
+ mf_file_attr_get_file_category(ent->d_name, &(pNode->type));
+
+ childpath = g_string_new(path);
+ if (childpath == NULL) {
+ SAFE_FREE_CHAR(pNode->path);
+ SAFE_FREE_CHAR(pNode->name);
+ SAFE_FREE_CHAR(pNode);
+ continue;
+ }
+ g_string_append_printf(childpath, "/%s", ent->d_name);
+ mf_file_attr_get_file_stat(childpath->str, &pNode);
+ if (pNode->type == FILE_TYPE_DIR)
+ *dir_list = eina_list_append(*dir_list, pNode);
+ else {
+ ret = mf_file_attr_get_file_ext(childpath->str, &pNode->ext);
+ if (ret != MYFILE_ERR_NONE) {
+ pNode->ext = NULL;
+ pNode->type = mf_file_attr_get_file_type_by_mime(childpath->str);
+ }
+ *file_list = eina_list_append(*file_list, pNode);
+ }
+ g_string_free(childpath, TRUE);
+ }
+ closedir(pDir);
+
+ return MYFILE_ERR_NONE;
+}
+
+
+/*********************
+**Function name: mf_fs_oper_create_dir
+**Parameter:
+** const char *file: dir need to be operation
+**
+**Return value:
+** error code
+**
+**Action:
+** create dir
+*********************/
+int mf_fs_oper_create_dir(const char *dir)
+{
+ int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_DUPLICATED;
+ int ret = mf_fs_oper_error(dir, dir, option);
+
+ if (ret != 0)
+ return ret;
+
+ ret = mf_file_attr_is_right_dir_path(dir);
+
+ if (ret != 0)
+ return ret;
+
+ errno = 0;
+ if (!mf_mkpath(dir)) {
+ ret = mf_error_erron_to_mferror(errno);
+ if (ret == MYFILE_ERR_NONE)
+ return MYFILE_ERR_DIR_CREATE_FAIL;
+ else
+ return ret;
+ }
+ sync();
+ return MYFILE_ERR_NONE;
+}
+
+
+/*********************
+**Function name: mf_fs_oper_rename_file
+**Parameter:
+** const char *src: source file need to rename
+** const char *dst: destination file which is to be renamed
+
+**
+**Return value:
+** error code
+**
+**Action:
+** rename a file
+*********************/
+int mf_fs_oper_rename_file(const char *src, const char *dst)
+{
+ int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_DST_ARG_VALID |
+ MF_ERROR_CHECK_SRC_EXIST | MF_ERROR_CHECK_DST_PATH_VALID |
+ MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_SRC_PATH_VALID | MF_ERROR_CHECK_DST_PARENT_DIR_EXIST | MF_ERROR_CHECK_DUPLICATED;
+ int ret = mf_fs_oper_error(src, dst, option);
+
+ if (ret != 0)
+ return ret;
+
+ if (rename(src, dst))
+ return MYFILE_ERR_RENAME_FAIL;
+ else
+ return MYFILE_ERR_NONE;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <app_control.h>
+#include <app_debug.h>
+#include <inputmgr.h>
+#include <viewmgr.h>
+#include <package_manager.h>
+#include <storage.h>
+#include <media_content.h>
+
+#include "define.h"
+#include "view.h"
+#include "data.h"
+#include "util/utils.h"
+#include "util/dialog_popup.h"
+#include "util/fs-util.h"
+#include "util/fs-error.h"
+#include "util/file-util.h"
+
+#define STYLE_TARGET_BTN "target_btn"
+
+typedef struct util_item_data {
+ int index;
+ Elm_Object_Item *item;
+ Eina_Bool expanded;
+
+ char *folder_name;
+} util_item_data_s;
+
+static char* _folder_list_label_get(void *data, Evas_Object *obj, const char *part);
+static Evas_Object* _folder_list_content_get(void *data, Evas_Object *obj, const char *part);
+static void _folder_list_del(void *data, Evas_Object *obj);
+
+static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Up *ev);
+
+static void _down_btn_cb(void *data, Evas_Object *obj, void *event_info);
+
+static void _selected(int id, void *data, Evas_Object *obj, Elm_Object_Item *item);
+static void _focused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item);
+static void _unfocused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item);
+
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev);
+
+static input_handler popup_handler = {
+ .key_up = _key_up_cb,
+ .selected = _selected,
+ .focused = _focused,
+ .unfocused = _unfocused
+};
+
+static input_handler focus_handler = {
+ .mouse_move = _mouse_move
+};
+
+static Eina_Bool ecore_timer_cb(void *data)
+{
+ Evas_Object * genlist = (Evas_Object *)data;
+ Elm_Object_Item * it = elm_genlist_selected_item_get(genlist);
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+check_changed_item_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object * genlist = (Evas_Object *)data;
+ ecore_timer_add(0.1, ecore_timer_cb, genlist);
+}
+
+static fsNodeInfo* _get_fsNodeInfo(Eina_List *list, int index)
+{
+ fsNodeInfo *node = NULL;
+ node = (fsNodeInfo *)eina_list_nth(list, index);
+
+ return node;
+}
+
+static void _selected(int id, void *data, Evas_Object *obj, Elm_Object_Item *item)
+{
+ struct _priv *priv;
+ priv = data;
+
+ int index = elm_genlist_item_index_get(item);
+ inputmgr_remove_callback(priv->popup_win, &popup_handler);
+ evas_object_del(priv->popup_win);
+
+ if (index == 1 || index == 2 || index == 4)
+ viewmgr_update_view(VIEW_BASE, UPDATE_FILE_TO_SELECT, priv);
+ else if (index == 3) {
+ dialog_popup_info_t *info = calloc(sizeof(dialog_popup_info_t), 1);
+
+ info->dialog_popup_type = DIALOG_POPUP_TYPE_INPUT_NAME;
+ info->title = "Rename";
+ info->content = "Content 3";
+ info->button_1_text = "OK";
+ info->button_2_text = "Cancel";
+ info->data = priv;
+
+ dialog_popup_create(info);
+ } else if (index == 5) {
+ dialog_popup_info_t *info = calloc(sizeof(dialog_popup_info_t), 1);
+
+ info->dialog_popup_type = DIALOG_POPUP_TYPE_YES_OR_CANCEL;
+ info->content = "Delete?";
+ info->button_1_text = "OK";
+ info->button_2_text = "Cancel";
+ info->data = priv;
+
+ dialog_popup_create(info);
+ } else if (index == 6) {
+ dialog_popup_info_t *info = calloc(sizeof(dialog_popup_info_t), 1);
+
+ info->dialog_popup_type = DIALOG_POPUP_TYPE_CONFIGURATION;
+ info->title = "Setting";
+ info->content = "Show hidden files";
+ info->button_1_text = "OK";
+ info->button_2_text = "Cancel";
+ info->data = priv;
+
+ dialog_popup_create(info);
+ }
+}
+
+static void _focused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item)
+{
+ elm_object_item_signal_emit(item, "mouse,in", "elm");
+ elm_genlist_item_update(item);
+}
+
+static void _unfocused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item)
+{
+ elm_object_item_signal_emit(item, "mouse,out", "elm");
+ elm_genlist_item_update(item);
+}
+
+static Evas_Object* create_check(Evas_Object *parent, void *data)
+{
+ Evas_Object *check;
+ check = elm_check_add(parent);
+ evas_object_smart_callback_add(check, "changed", check_changed_item_cb, data);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ return check;
+}
+
+static char*
+_folder_list_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[256];
+ util_item_data_s *id = (util_item_data_s *)data;
+
+ if (!strcmp("elm.text.file", part)) {
+ if (id->folder_name == NULL)
+ return NULL;
+
+ snprintf(buf, sizeof(buf), "%s", id->folder_name);
+ return strdup(buf);
+ } else {
+ if (id->index == 0) {
+ snprintf(buf, sizeof(buf), "Copy");
+ return strdup(buf);
+ } else if (id->index == 1) {
+ snprintf(buf, sizeof(buf), "Move");
+ return strdup(buf);
+ } else if (id->index == 2) {
+ snprintf(buf, sizeof(buf), "Rename");
+ return strdup(buf);
+ } else if (id->index == 3) {
+ snprintf(buf, sizeof(buf), "New folder");
+ return strdup(buf);
+ } else if (id->index == 4) {
+ snprintf(buf, sizeof(buf), "Delete");
+ return strdup(buf);
+ } else if (id->index == 5) {
+ snprintf(buf, sizeof(buf), "Setting");
+ return strdup(buf);
+ }
+ }
+ return NULL;
+}
+
+static Evas_Object*
+_folder_list_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp("elm.swallow.icon", part)) {
+ Evas_Object *icon = elm_image_add(obj);
+
+ elm_image_file_set(icon, IMGDIR"/icon/myfile_icon_folder.png", NULL);
+ return icon;
+ } else if (!strcmp("elm.swallow.end", part)) {
+ return create_check(obj, data);
+ }
+
+ return NULL;
+}
+
+static void
+_folder_list_del(void *data, Evas_Object *obj)
+{
+ /* Unrealized callback can be called after this. */
+ /* Accessing item_data_s can be dangerous on unrealized callback. */
+ util_item_data_s *id = (util_item_data_s *)data;
+ free(id);
+}
+
+static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Up *ev)
+{
+ if (!data)
+ return;
+
+ struct _priv *priv;
+ priv = (struct _priv *)data;
+
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_ESC)) {
+ inputmgr_remove_callback(priv->popup_win, &popup_handler);
+ evas_object_del(priv->popup_win);
+ }
+}
+
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev)
+{
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static void _down_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ struct _priv *priv;
+ priv = data;
+
+ viewmgr_update_view(VIEW_BASE, UPDATE_FILE, priv);
+ evas_object_del(priv->popup_win);
+}
+
+Evas_Object *utils_add_window(const char *name)
+{
+ Evas_Object *win;
+
+ if (!name) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (!win) {
+ _ERR("elm_win_add failed.");
+ return NULL;
+ }
+
+ elm_win_title_set(win, name);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+
+ evas_object_show(win);
+
+ return win;
+}
+
+Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
+ Eina_Bool win_resize)
+{
+ Evas_Object *layout;
+
+ if (!parent || !group) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ layout = elm_layout_add(parent);
+ if (!layout) {
+ _ERR("elm_layout_add failed.");
+ return NULL;
+ }
+
+ elm_layout_file_set(layout, EDJEFILE, group);
+
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (win_resize)
+ elm_win_resize_object_add(parent, layout);
+
+ return layout;
+}
+
+Evas_Object *utils_add_box(Evas_Object *parent, const char *part,
+ Eina_Bool horizontal, Evas_Coord padding_h,
+ Evas_Coord padding_v)
+{
+ Evas_Object *box;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ box = elm_box_add(parent);
+ if (!box) {
+ _ERR("elm_box_add failed.");
+ return NULL;
+ }
+
+ elm_box_horizontal_set(box, horizontal);
+ elm_box_padding_set(box, ELM_SCALE_SIZE(padding_h),
+ ELM_SCALE_SIZE(padding_v));
+
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ if (part)
+ elm_object_part_content_set(parent, part, box);
+ else
+ elm_object_content_set(parent, box);
+
+ evas_object_show(box);
+
+ return box;
+}
+
+Evas_Object *utils_add_button(Evas_Object *parent, const char *part,
+ const char *text, const char *style)
+{
+ Evas_Object *btn;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ btn = elm_button_add(parent);
+ if (!btn) {
+ _ERR("elm_button_add failed.");
+ return NULL;
+ }
+
+ if (part)
+ elm_object_part_content_set(parent, part, btn);
+ if (text)
+ elm_object_text_set(btn, text);
+ if (style)
+ elm_object_style_set(btn, style);
+
+ evas_object_show(btn);
+
+ return btn;
+}
+
+Evas_Object *utils_add_gengrid(Evas_Object *parent, Eina_Bool horizontal,
+ int width, int height)
+{
+ Evas_Object *grid;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ grid = elm_gengrid_add(parent);
+ if (!grid) {
+ _ERR("elm_gengrid_add failed.");
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ elm_gengrid_multi_select_set(grid, EINA_FALSE);
+ elm_gengrid_horizontal_set(grid, horizontal);
+ elm_gengrid_align_set(grid, 0.0, 0.0);
+ elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_gengrid_item_size_set(grid, ELM_SCALE_SIZE(width),
+ ELM_SCALE_SIZE(height));
+ elm_scroller_policy_set(grid, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+
+ return grid;
+}
+
+Evas_Object *utils_add_table(Evas_Object *parent, const char *part,
+ int padding_x, int padding_y)
+{
+ Evas_Object *table;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ table = elm_table_add(parent);
+ if (!table) {
+ _ERR("elm_table_add failed.");
+ return NULL;
+ }
+
+ elm_table_padding_set(table, ELM_SCALE_SIZE(padding_x),
+ ELM_SCALE_SIZE(padding_y));
+ evas_object_show(table);
+
+ if (part)
+ elm_object_part_content_set(parent, part, table);
+
+ return table;
+}
+
+static void _notify_timeout_cb(void *data, Evas_Object *obj, void *ei)
+{
+ if (!obj)
+ return;
+
+ evas_object_del(obj);
+}
+
+Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
+ const char *noti_style, const char *label_style, int timeout)
+{
+ Evas_Object *notify, *lbl;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ notify = elm_notify_add(parent);
+ if (!notify) {
+ _ERR("elm_notify_add failed.");
+ return NULL;
+ }
+
+ evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_notify_align_set(notify, 0.0, 1.0);
+ elm_notify_timeout_set(notify, timeout);
+
+ if (noti_style)
+ elm_object_style_set(notify, noti_style);
+
+ lbl = elm_label_add(notify);
+ if (!lbl) {
+ _ERR("elm_label_add failed.");
+ evas_object_del(notify);
+ return NULL;
+ }
+
+ elm_object_content_set(notify, lbl);
+ evas_object_show(lbl);
+
+ if (label_style)
+ elm_object_style_set(lbl, label_style);
+
+ if (text)
+ elm_object_text_set(lbl, text);
+
+ evas_object_smart_callback_add(notify, SIG_TIMEOUT,
+ _notify_timeout_cb, NULL);
+ evas_object_show(notify);
+
+ return notify;
+}
+
+void utils_show_submenu_popup(struct _priv *priv)
+{
+ Evas_Object *notification_popup;
+ Evas_Object *window_layout = NULL;
+ Evas_Object *scroller, *genlist;
+
+ util_item_data_s *id;
+
+ Evas *e = NULL;
+ Ecore_Evas *ee = NULL;
+ Eina_Bool result = EINA_FALSE;
+ int screen_x, screen_y, screen_w, screen_h;
+
+ notification_popup = elm_win_add(NULL, "notification_popup", ELM_WIN_BASIC);
+ priv->popup_win = notification_popup;
+
+ if (notification_popup == NULL) {
+ _ERR("elm_win_add failed");
+ goto out;
+ }
+
+ e = evas_object_evas_get(notification_popup);
+ if (!e) {
+ _ERR("evas_object_evas_get failed");
+ evas_object_del(notification_popup);
+ notification_popup = NULL;
+ goto out;
+ }
+
+ ee = ecore_evas_ecore_evas_get(e);
+ if (!ee) {
+ _ERR("ecore_evas_ecore_evas_get failed");
+ evas_object_del(notification_popup);
+ notification_popup = NULL;
+ goto out;
+ }
+
+ elm_win_alpha_set(notification_popup, EINA_TRUE);
+ elm_win_borderless_set(notification_popup, EINA_TRUE);
+ elm_win_autodel_set(notification_popup, EINA_TRUE);
+
+ elm_win_screen_size_get(notification_popup, &screen_x, &screen_y, &screen_w, &screen_h);
+
+ window_layout = elm_layout_add(notification_popup);
+ result = elm_layout_file_set(window_layout, EDJEFILE, GRP_VIEW_SUBMENU);
+ _DBG("Layout elm_layout_file_set for [%s] returns [%d]", EDJEFILE, result);
+ evas_object_resize(window_layout, screen_w, screen_h);
+ evas_object_show(window_layout);
+
+ scroller = elm_scroller_add(window_layout);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_object_part_content_set(window_layout, "submenu_genlist", scroller);
+ elm_scroller_movement_block_set(scroller, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL);
+ elm_object_scale_set(scroller, 1/edje_scale_get());
+ evas_object_show(scroller);
+
+ genlist = elm_genlist_add(scroller);
+ elm_object_focus_allow_set(genlist, EINA_TRUE);
+
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_1text";
+ itc->func.text_get = _folder_list_label_get;
+
+ int i;
+ for (i = 0; i < 6; i++) {
+ id = calloc(sizeof(util_item_data_s), 1);
+ id->index = i;
+
+ elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+ elm_genlist_item_class_free(itc);
+ elm_object_content_set(scroller, genlist);
+
+ elm_object_item_focus_set(elm_genlist_first_item_get(genlist), EINA_TRUE);
+ inputmgr_add_callback(genlist, 0, &popup_handler, priv);
+
+ evas_object_show(notification_popup);
+ elm_win_activate(notification_popup);
+
+out:
+ return;
+}
+
+void utils_show_select_folder_popup(struct _priv *priv)
+{
+ Evas_Object *notification_popup;
+ Evas_Object *window_layout = NULL;
+ Evas_Object *ok_btn, *cancel_btn, *new_folder_btn;
+ Evas_Object *scroller, *genlist;
+
+ util_item_data_s *id;
+ list_data_s *list_data = calloc(sizeof(list_data_s), 1);
+
+ char *path = NULL;
+ fsNodeInfo *node = NULL;
+
+ int screen_x, screen_y, screen_w, screen_h;
+
+ notification_popup = elm_win_add(NULL, "notification_popup", ELM_WIN_BASIC);
+ priv->popup_win = notification_popup;
+
+ elm_win_screen_size_get(notification_popup, &screen_x, &screen_y, &screen_w, &screen_h);
+
+ elm_win_alpha_set(notification_popup, EINA_TRUE);
+ elm_win_borderless_set(notification_popup, EINA_TRUE);
+ elm_win_autodel_set(notification_popup, EINA_TRUE);
+
+ window_layout = elm_layout_add(notification_popup);
+ elm_layout_file_set(window_layout, EDJEFILE, GRP_VIEW_SELECT_FOLDER);
+ evas_object_resize(window_layout, screen_w, screen_h);
+ evas_object_show(window_layout);
+
+ scroller = elm_scroller_add(window_layout);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_object_part_content_set(window_layout, "select_folder_genlist", scroller);
+ elm_object_scale_set(scroller, 1/edje_scale_get());
+ elm_object_focus_allow_set(scroller, EINA_TRUE);
+ evas_object_show(scroller);
+
+ ok_btn = elm_button_add(window_layout);
+ elm_object_style_set(ok_btn, STYLE_TARGET_BTN);
+ elm_object_focus_allow_set(ok_btn, EINA_TRUE);
+ elm_object_part_content_set(window_layout, "select_folder_ok_btn", ok_btn);
+ elm_object_part_text_set(ok_btn, "part_popup_btn_text", "OK");
+ evas_object_show(ok_btn);
+
+ cancel_btn = elm_button_add(window_layout);
+ elm_object_style_set(cancel_btn, STYLE_TARGET_BTN);
+ elm_object_focus_allow_set(cancel_btn, EINA_TRUE);
+ elm_object_part_content_set(window_layout, "select_folder_cancel_btn", cancel_btn);
+ elm_object_part_text_set(cancel_btn, "part_popup_btn_text", "Cancel");
+ evas_object_show(cancel_btn);
+
+ new_folder_btn = elm_button_add(window_layout);
+ elm_object_style_set(new_folder_btn, STYLE_TARGET_BTN);
+ elm_object_focus_allow_set(new_folder_btn, EINA_TRUE);
+ elm_object_part_content_set(window_layout, "select_folder_newfolder_btn", new_folder_btn);
+ elm_object_part_text_set(new_folder_btn, "part_popup_btn_text", "New Folder");
+ evas_object_show(new_folder_btn);
+
+ elm_object_focus_next_object_set(ok_btn, cancel_btn, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(cancel_btn, ok_btn, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(cancel_btn, new_folder_btn, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(new_folder_btn, cancel_btn, ELM_FOCUS_LEFT);
+
+ genlist = elm_genlist_add(scroller);
+
+ path = Get_Root_Path(STORAGE_TYPE_INTERNAL);
+ list_data->path = path;
+
+ int ret = mf_fs_oper_read_dir(list_data->path, &list_data->folder_list, &list_data->file_list);
+ if (ret != MYFILE_ERR_NONE) {
+ free(path);
+ free(list_data);
+ return;
+ }
+
+ list_data->file_count = eina_list_count(list_data->file_list);
+ list_data->folder_count = eina_list_count(list_data->folder_list);
+
+ Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+ itc->item_style = "custom_file_target";
+ itc->func.text_get = _folder_list_label_get;
+ itc->func.content_get = _folder_list_content_get;
+ itc->func.del = _folder_list_del;
+
+ int i;
+ for (i = 0; i < list_data->folder_count; i++) {
+ id = calloc(sizeof(util_item_data_s), 1);
+ id->index = i;
+
+ node = _get_fsNodeInfo(list_data->folder_list, id->index);
+ id->folder_name = strdup(node->name);
+
+ elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+ elm_genlist_item_class_free(itc);
+ elm_object_content_set(scroller, genlist);
+
+ inputmgr_add_callback(notification_popup, 0, &popup_handler, priv);
+ inputmgr_add_callback(genlist, 0, &popup_handler, priv);
+
+ inputmgr_add_callback(ok_btn, 0, &focus_handler, priv);
+ inputmgr_add_callback(cancel_btn, 0, &focus_handler, priv);
+ inputmgr_add_callback(new_folder_btn, 0, &focus_handler, priv);
+
+ evas_object_smart_callback_add(cancel_btn, "clicked", _down_btn_cb, priv);
+
+ evas_object_show(notification_popup);
+ elm_win_activate(notification_popup);
+
+ free(list_data);
+
+ return;
+}
+
+Evas_Object *utils_add_popup(Evas_Object *parent, const char *style,
+ const char *popup_title, const char *popup_text)
+{
+ Evas_Object *popup;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ popup = elm_popup_add(parent);
+ if (!popup) {
+ _ERR("elm_popup_add failed.");
+ return NULL;
+ }
+
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP_RIGHT);
+
+
+ if (style)
+ elm_object_style_set(popup, style);
+
+ if (popup_title)
+ elm_object_part_text_set(popup, PART_POPUP_TITLE, popup_title);
+
+ if (popup_text)
+ elm_object_text_set(popup, popup_text);
+
+ evas_object_show(popup);
+
+ return popup;
+}
+
+Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
+ const char **opt_text, input_handler *opt_handler, void *data)
+{
+ Evas_Object *ctxpopup, *box, *btn = NULL, *firstbtn = NULL;
+ int i;
+
+ if (!parent || opt_size <= 0 || !opt_text) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ ctxpopup = elm_ctxpopup_add(parent);
+ if (!ctxpopup) {
+ _ERR("elm_ctxpopup_add failed.");
+ return NULL;
+ }
+
+ box = utils_add_box(ctxpopup, NULL, EINA_FALSE, 0, 0);
+ if (!box) {
+ _ERR("Add box failed.");
+ evas_object_del(ctxpopup);
+ return NULL;
+ }
+
+ elm_object_style_set(ctxpopup, STYLE_CTXPOPUP);
+ elm_object_content_set(ctxpopup, box);
+ elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
+ evas_object_show(ctxpopup);
+
+ for (i = 0; i < opt_size; i++) {
+ btn = utils_add_button(box, NULL, opt_text[i],
+ STYLE_OPTION_BTN);
+ if (!btn) {
+ _ERR("Add button failed.");
+ evas_object_del(ctxpopup);
+ return NULL;
+ }
+
+ elm_box_pack_end(box, btn);
+
+ if (opt_handler)
+ inputmgr_add_callback(btn, opt_id[i],
+ opt_handler, data);
+
+ if (i == 0)
+ firstbtn = btn;
+ }
+
+ elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
+
+ return ctxpopup;
+}
+
+Evas_Object *utils_add_scroller(Evas_Object *parent, const char *part,
+ Evas_Object *content)
+{
+ Evas_Object *scr;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ scr = elm_scroller_add(parent);
+ if (!scr) {
+ _ERR("elm_scroller_add failed.");
+ return NULL;
+ }
+
+ elm_scroller_policy_set(scr,
+ ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_object_focus_allow_set(scr, EINA_FALSE);
+
+ if (part)
+ elm_object_part_content_set(parent, part, scr);
+
+ if (content)
+ elm_object_content_set(scr, content);
+
+ return scr;
+}
+
+bool utils_launch_app(const char *appid, const char *key, const char *value)
+{
+ app_control_h app_ctrl;
+ int r;
+
+ if (!appid) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ r = app_control_create(&app_ctrl);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("App control handle create failed.");
+ return false;
+ }
+
+ r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("App control set operation failed.");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ if (key && value) {
+ r = app_control_add_extra_data(app_ctrl, key, value);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("App control set extra data failed.");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+ }
+
+ r = app_control_set_app_id(app_ctrl, appid);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("App control set app id failed.");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ r = app_control_send_launch_request(app_ctrl, NULL, NULL);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("App control send launch request failed.");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ app_control_destroy(app_ctrl);
+
+ return true;
+}
+
+bool utils_uninstall_app(const char *pkgid, const char *pkgtype)
+{
+ package_manager_request_h request_h;
+ int r, id;
+
+ if (!pkgid || !pkgtype) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ r = package_manager_request_create(&request_h);
+ if (r != PACKAGE_MANAGER_ERROR_NONE) {
+ _ERR("Request handle create failed.");
+ return false;
+ }
+
+ r = package_manager_request_set_type(request_h, pkgtype);
+ if (r != PACKAGE_MANAGER_ERROR_NONE) {
+ _ERR("Set pkg type failed.");
+ package_manager_request_destroy(request_h);
+ return false;
+ }
+
+ r = package_manager_request_set_mode(request_h,
+ PACKAGE_MANAGER_REQUEST_MODE_QUIET);
+ if (r != PACKAGE_MANAGER_ERROR_NONE) {
+ _ERR("Set request mode failed.");
+ package_manager_request_destroy(request_h);
+ return false;
+ }
+
+ r = package_manager_request_uninstall(request_h, pkgid, &id);
+ if (r != PACKAGE_MANAGER_ERROR_NONE) {
+ _ERR("Uninstall failed.");
+ package_manager_request_destroy(request_h);
+ return false;
+ }
+
+ package_manager_request_destroy(request_h);
+
+ return true;
+}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <Elementary.h>
-#include <app_control.h>
-#include <app_debug.h>
-#include <package_manager.h>
-
-#include "define.h"
-#include "utils.h"
-
-Evas_Object *utils_add_window(const char *name)
-{
- Evas_Object *win;
-
- if (!name) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- win = elm_win_add(NULL, name, ELM_WIN_BASIC);
- if (!win) {
- _ERR("elm_win_add failed.");
- return NULL;
- }
-
- elm_win_title_set(win, name);
- elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
-
- evas_object_show(win);
-
- return win;
-}
-
-Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
- Eina_Bool win_resize)
-{
- Evas_Object *layout;
-
- if (!parent || !group) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- layout = elm_layout_add(parent);
- if (!layout) {
- _ERR("elm_layout_add failed.");
- return NULL;
- }
-
- elm_layout_file_set(layout, EDJEFILE, group);
-
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
-
- if (win_resize)
- elm_win_resize_object_add(parent, layout);
-
- return layout;
-}
-
-Evas_Object *utils_add_box(Evas_Object *parent, const char *part,
- Eina_Bool horizontal, Evas_Coord padding_h,
- Evas_Coord padding_v)
-{
- Evas_Object *box;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- box = elm_box_add(parent);
- if (!box) {
- _ERR("elm_box_add failed.");
- return NULL;
- }
-
- elm_box_horizontal_set(box, horizontal);
- elm_box_padding_set(box, ELM_SCALE_SIZE(padding_h),
- ELM_SCALE_SIZE(padding_v));
-
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- if (part)
- elm_object_part_content_set(parent, part, box);
- else
- elm_object_content_set(parent, box);
-
- evas_object_show(box);
-
- return box;
-}
-
-Evas_Object *utils_add_button(Evas_Object *parent, const char *part,
- const char *text, const char *style)
-{
- Evas_Object *btn;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- btn = elm_button_add(parent);
- if (!btn) {
- _ERR("elm_button_add failed.");
- return NULL;
- }
-
- if (part)
- elm_object_part_content_set(parent, part, btn);
- if (text)
- elm_object_text_set(btn, text);
- if (style)
- elm_object_style_set(btn, style);
-
- evas_object_show(btn);
-
- return btn;
-}
-
-Evas_Object *utils_add_gengrid(Evas_Object *parent, Eina_Bool horizontal,
- int width, int height)
-{
- Evas_Object *grid;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- grid = elm_gengrid_add(parent);
- if (!grid) {
- _ERR("elm_gengrid_add failed.");
- return NULL;
- }
-
- evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- elm_gengrid_multi_select_set(grid, EINA_FALSE);
- elm_gengrid_horizontal_set(grid, horizontal);
- elm_gengrid_align_set(grid, 0.0, 0.0);
- elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
- elm_gengrid_item_size_set(grid, ELM_SCALE_SIZE(width),
- ELM_SCALE_SIZE(height));
- elm_scroller_policy_set(grid, ELM_SCROLLER_POLICY_OFF,
- ELM_SCROLLER_POLICY_OFF);
-
- return grid;
-}
-
-Evas_Object *utils_add_table(Evas_Object *parent, const char *part,
- int padding_x, int padding_y)
-{
- Evas_Object *table;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- table = elm_table_add(parent);
- if (!table) {
- _ERR("elm_table_add failed.");
- return NULL;
- }
-
- elm_table_padding_set(table, ELM_SCALE_SIZE(padding_x),
- ELM_SCALE_SIZE(padding_y));
- evas_object_show(table);
-
- if (part)
- elm_object_part_content_set(parent, part, table);
-
- return table;
-}
-
-static void _notify_timeout_cb(void *data, Evas_Object *obj, void *ei)
-{
- if (!obj)
- return;
-
- evas_object_del(obj);
-}
-
-Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
- const char *noti_style, const char *label_style, int timeout)
-{
- Evas_Object *notify, *lbl;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- notify = elm_notify_add(parent);
- if (!notify) {
- _ERR("elm_notify_add failed.");
- return NULL;
- }
-
- evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_notify_align_set(notify, 0.0, 1.0);
- elm_notify_timeout_set(notify, timeout);
-
- if (noti_style)
- elm_object_style_set(notify, noti_style);
-
- lbl = elm_label_add(notify);
- if (!lbl) {
- _ERR("elm_label_add failed.");
- evas_object_del(notify);
- return NULL;
- }
-
- elm_object_content_set(notify, lbl);
- evas_object_show(lbl);
-
- if (label_style)
- elm_object_style_set(lbl, label_style);
-
- if (text)
- elm_object_text_set(lbl, text);
-
- evas_object_smart_callback_add(notify, SIG_TIMEOUT,
- _notify_timeout_cb, NULL);
- evas_object_show(notify);
-
- return notify;
-}
-
-Evas_Object *utils_add_popup(Evas_Object *parent, const char *style,
- const char *popup_title, const char *popup_text)
-{
- Evas_Object *popup;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- popup = elm_popup_add(parent);
- if (!popup) {
- _ERR("elm_popup_add failed.");
- return NULL;
- }
-
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
- evas_object_show(popup);
-
- if (style)
- elm_object_style_set(popup, style);
-
- if (popup_title)
- elm_object_part_text_set(popup, PART_POPUP_TITLE, popup_title);
-
- if (popup_text)
- elm_object_text_set(popup, popup_text);
-
- return popup;
-}
-
-Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
- const char **opt_text, input_handler *opt_handler, void *data)
-{
- Evas_Object *ctxpopup, *box, *btn = NULL, *firstbtn = NULL;
- int i;
-
- if (!parent || opt_size <= 0 || !opt_text) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- ctxpopup = elm_ctxpopup_add(parent);
- if (!ctxpopup) {
- _ERR("elm_ctxpopup_add failed.");
- return NULL;
- }
-
- box = utils_add_box(ctxpopup, NULL, EINA_FALSE, 0, 0);
- if (!box) {
- _ERR("Add box failed.");
- evas_object_del(ctxpopup);
- return NULL;
- }
-
- elm_object_style_set(ctxpopup, STYLE_CTXPOPUP);
- elm_object_content_set(ctxpopup, box);
- elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
- evas_object_show(ctxpopup);
-
- for (i = 0; i < opt_size; i++) {
- btn = utils_add_button(box, NULL, opt_text[i],
- STYLE_OPTION_BTN);
- if (!btn) {
- _ERR("Add button failed.");
- evas_object_del(ctxpopup);
- return NULL;
- }
-
- elm_box_pack_end(box, btn);
-
- if (opt_handler)
- inputmgr_add_callback(btn, opt_id[i],
- opt_handler, data);
-
- if (i == 0)
- firstbtn = btn;
- }
-
- elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
- elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
-
- return ctxpopup;
-}
-
-Evas_Object *utils_add_scroller(Evas_Object *parent, const char *part,
- Evas_Object *content)
-{
- Evas_Object *scr;
-
- if (!parent) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- scr = elm_scroller_add(parent);
- if (!scr) {
- _ERR("elm_scroller_add failed.");
- return NULL;
- }
-
- elm_scroller_policy_set(scr,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_object_focus_allow_set(scr, EINA_FALSE);
-
- if (part)
- elm_object_part_content_set(parent, part, scr);
-
- if (content)
- elm_object_content_set(scr, content);
-
- return scr;
-}
-
-bool utils_launch_app(const char *appid, const char *key, const char *value)
-{
- app_control_h app_ctrl;
- int r;
-
- if (!appid) {
- _ERR("Invalid argument.");
- return false;
- }
-
- r = app_control_create(&app_ctrl);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("App control handle create failed.");
- return false;
- }
-
- r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("App control set operation failed.");
- app_control_destroy(app_ctrl);
- return false;
- }
-
- if (key && value) {
- r = app_control_add_extra_data(app_ctrl, key, value);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("App control set extra data failed.");
- app_control_destroy(app_ctrl);
- return false;
- }
- }
-
- r = app_control_set_app_id(app_ctrl, appid);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("App control set app id failed.");
- app_control_destroy(app_ctrl);
- return false;
- }
-
- r = app_control_send_launch_request(app_ctrl, NULL, NULL);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("App control send launch request failed.");
- app_control_destroy(app_ctrl);
- return false;
- }
-
- app_control_destroy(app_ctrl);
-
- return true;
-}
-
-bool utils_uninstall_app(const char *pkgid, const char *pkgtype)
-{
- package_manager_request_h request_h;
- int r, id;
-
- if (!pkgid || !pkgtype) {
- _ERR("Invalid argument.");
- return false;
- }
-
- r = package_manager_request_create(&request_h);
- if (r != PACKAGE_MANAGER_ERROR_NONE) {
- _ERR("Request handle create failed.");
- return false;
- }
-
- r = package_manager_request_set_type(request_h, pkgtype);
- if (r != PACKAGE_MANAGER_ERROR_NONE) {
- _ERR("Set pkg type failed.");
- package_manager_request_destroy(request_h);
- return false;
- }
-
- r = package_manager_request_set_mode(request_h,
- PACKAGE_MANAGER_REQUEST_MODE_QUIET);
- if (r != PACKAGE_MANAGER_ERROR_NONE) {
- _ERR("Set request mode failed.");
- package_manager_request_destroy(request_h);
- return false;
- }
-
- r = package_manager_request_uninstall(request_h, pkgid, &id);
- if (r != PACKAGE_MANAGER_ERROR_NONE) {
- _ERR("Uninstall failed.");
- package_manager_request_destroy(request_h);
- return false;
- }
-
- package_manager_request_destroy(request_h);
-
- return true;
-}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+#include <layoutmgr.h>
+#include <app_contents.h>
+#include <app_define.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "view.h"
+#include "layout.h"
+#include "data.h"
+#include "util/utils.h"
+#include "util/dialog_popup.h"
+#include "util/file-util.h"
+#include "util/fs-util.h"
+#include "util/fs-error.h"
+
+#define STYLE_MENU_BTN "menu_btn"
+
+struct _menu_item {
+ const char *name;
+ const char *layout_id;
+ layout_class *(*func_get_lclass)(void);
+};
+
+static struct _menu_item g_menu_item[E_LAYOUT_MAX] = {
+ [E_LAYOUT_DEFAULT] = {
+ "Default",
+ LAYOUT_DEFAULT,
+ layout_default_get_lclass,
+ }
+};
+
+static void
+gengrid_it_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int index, count, i;
+ Elm_Object_Item *next_it, *deleted_it;
+
+ index = elm_gengrid_item_index_get(event_info);
+ count = elm_gengrid_items_count(obj);
+ next_it = elm_gengrid_item_next_get(event_info);
+ deleted_it = next_it;
+
+ for (i = 0; i < count-index; i++) {
+ next_it = elm_gengrid_item_next_get(deleted_it);
+ elm_object_item_del(deleted_it);
+ deleted_it = next_it;
+ }
+}
+
+static char*
+gengrid_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[1024];
+ path_item_data_s *id = data;
+ int index = id->index;
+
+ if (!strcmp(part, "elm.text")) {
+ if (index == -1)
+ snprintf(buf, 1023, "%s", id->selected_folder);
+ else if (index == 0)
+ snprintf(buf, 1023, "%s", "Home");
+
+ return strdup(buf);
+ } else
+ return NULL;
+}
+
+static Evas_Object*
+create_gengrid(struct _priv *priv)
+{
+ path_item_data_s *id;
+ int w, h;
+ Elm_Gengrid_Item_Class *gic;
+ Evas_Object *gengrid;
+ Elm_Object_Item *item;
+
+ gengrid = elm_gengrid_add(priv->base);
+ evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ w = (int)(ELM_SCALE_SIZE(150));
+ h = (int)(ELM_SCALE_SIZE(100));
+ elm_gengrid_item_size_set(gengrid, w, h);
+ elm_gengrid_align_set(gengrid, 0.0, 0.5);
+ elm_gengrid_horizontal_set(gengrid, EINA_TRUE);
+ elm_gengrid_multi_select_set(gengrid, EINA_FALSE);
+ elm_scroller_policy_set(gengrid, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+
+ priv->selected_parent_path = Get_Root_Path(STORAGE_TYPE_INTERNAL);
+
+ gic = elm_gengrid_item_class_new();
+ gic->item_style = "custom_1text";
+
+ gic->func.text_get = gengrid_text_get_cb;
+
+ id = calloc(sizeof(path_item_data_s), 1);
+ id->index = 0;
+ id->parent_path = priv->selected_parent_path;
+ item = elm_gengrid_item_append(gengrid, gic, id, gengrid_it_cb, id);
+ id->item = item;
+ mf_file_attr_get_path_level(id->parent_path, &id->level);
+
+ elm_object_item_data_set(item, id);
+
+ evas_object_show(gengrid);
+ elm_gengrid_item_class_free(gic);
+
+ return gengrid;
+}
+
+static void
+update_gengrid(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ path_item_data_s *id;
+ Elm_Gengrid_Item_Class *gic;
+ Elm_Object_Item *item, *delete;
+
+ int buffer_size;
+ char *new_path;
+
+ Evas_Object *file_path = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+
+ buffer_size = strlen(priv->selected_parent_path)+strlen("/")+strlen(priv->selected_folder);
+ new_path = (char *)calloc(buffer_size+1, sizeof(char));
+ snprintf(new_path, buffer_size+1, "%s%s%s", priv->selected_parent_path, "/", priv->selected_folder);
+
+ if (priv->same == 1) {
+ delete = elm_gengrid_last_item_get(file_path);
+ elm_object_item_del(delete);
+ } else if (priv->same < 0) {
+ int i;
+ int num = priv->same * (-1);
+ for (i = 0; i < num; i++) {
+ delete = elm_gengrid_last_item_get(file_path);
+ elm_object_item_del(delete);
+ }
+ delete = elm_gengrid_last_item_get(file_path);
+ elm_object_item_del(delete);
+ }
+
+ gic = elm_gengrid_item_class_new();
+ gic->item_style = "custom_1text";
+
+ gic->func.text_get = gengrid_text_get_cb;
+
+ id = calloc(sizeof(path_item_data_s), 1);
+ id->selected_folder = priv->selected_folder;
+ id->parent_path = priv->selected_parent_path;
+ id->index = -1;
+
+ id->full_path = new_path;
+ mf_file_attr_get_path_level(id->full_path, &id->level);
+
+ item = elm_gengrid_item_append(file_path, gic, id, gengrid_it_cb, id);
+ id->item = item;
+
+ elm_object_item_data_set(item, id);
+ evas_object_show(file_path);
+ elm_gengrid_item_class_free(gic);
+
+ free(new_path);
+ return;
+}
+
+
+static void _menu_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ struct _priv *priv = data;
+
+ Elm_Object_Item *item;
+
+ Evas_Object *file_path = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+ item = elm_gengrid_last_item_get(file_path);
+
+ path_item_data_s *id = elm_object_item_data_get(item);
+
+ priv->selected_folder = id->selected_folder;
+ priv->selected_parent_path = id->parent_path;
+
+ utils_show_submenu_popup(priv);
+}
+
+static void _menu_cb2(void *data, Evas_Object *obj, void *event_info)
+{
+ struct _priv *priv = data;
+ priv->popup_base = obj;
+
+ Elm_Object_Item *item;
+
+ Evas_Object *file_path = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+ item = elm_gengrid_last_item_get(file_path);
+
+ path_item_data_s *id = elm_object_item_data_get(item);
+
+ priv->selected_folder = id->selected_folder;
+ priv->selected_parent_path = id->parent_path;
+
+ utils_show_select_folder_popup(priv);
+}
+
+static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Up *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_ESC))
+ ui_app_exit();
+
+ return;
+}
+
+static input_handler _menu_input_handler = {
+ .key_up = _key_up_cb
+};
+
+static bool _draw_menu(struct _priv *priv)
+{
+ Evas_Object *icon = elm_button_add(priv->base);
+
+ elm_object_style_set(icon, STYLE_MENU_BTN);
+ elm_object_part_content_set(priv->base, PART_MENU, icon);
+ evas_object_resize(icon, 46, 46);
+ evas_object_show(icon);
+ elm_object_focus_allow_set(icon, EINA_TRUE);
+
+ Evas_Object *icon2 = elm_button_add(priv->base);
+
+ elm_object_style_set(icon2, STYLE_MENU_BTN);
+ elm_object_part_content_set(priv->base, PART_CONFIRM, icon2);
+ evas_object_resize(icon2, 46, 46);
+ elm_object_focus_allow_set(icon2, EINA_TRUE);
+
+ priv->icon1 = icon;
+ priv->icon2 = icon2;
+
+ evas_object_smart_callback_add(icon, "clicked", _menu_cb, priv);
+ evas_object_smart_callback_add(icon2, "clicked", _menu_cb2, priv);
+
+ Evas_Object *path = elm_object_part_content_get(priv->base, PART_FILE_PATH);
+ elm_object_focus_next_object_set(path, icon, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(icon, path, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(icon, icon2, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(icon2, icon, ELM_FOCUS_RIGHT);
+
+ return true;
+}
+
+static bool _draw_file_path(struct _priv *priv)
+{
+ Evas_Object *gengrid = NULL;
+
+ gengrid = create_gengrid(priv);
+ evas_object_show(gengrid);
+
+ elm_object_part_content_set(priv->base, PART_FILE_PATH, gengrid);
+
+ return true;
+}
+
+static bool _draw_view_content(struct _priv *priv)
+{
+ if (!priv)
+ return false;
+
+ if (!_draw_file_path(priv)) {
+ _ERR("Draw file path failed.");
+ return false;
+ }
+ if (!_draw_menu(priv)) {
+ _ERR("Draw menu failed.");
+ return false;
+ }
+
+ return true;
+}
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv;
+ Evas_Object *base;
+ layoutmgr *lmgr;
+ int i;
+
+ if (!win) {
+ _ERR("Get window object failed.");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(*priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ return NULL;
+ }
+
+ base = utils_add_layout(win, GRP_LAYOUT_BASE, EINA_TRUE);
+
+ if (!base) {
+ _ERR("Add layout failed.");
+ free(priv);
+ return NULL;
+ }
+
+ priv->win = win;
+ priv->base = base;
+
+ if (!_draw_view_content(priv)) {
+ _ERR("failed to draw contents");
+ free(priv);
+ return NULL;
+ }
+
+ lmgr = layoutmgr_create(base);
+ priv->lmgr = lmgr;
+
+ for (i = 0; i < 1; i++)
+ layoutmgr_add_layout(lmgr, g_menu_item[i].func_get_lclass(), priv);
+
+ if (!viewmgr_set_view_data(VIEW_BASE, priv)) {
+ _ERR("Set view data failed.");
+ goto end;
+ }
+
+ inputmgr_add_callback(priv->base, 0, &_menu_input_handler, priv);
+
+ return base;
+
+end:
+ evas_object_del(base);
+ free(priv);
+
+ return NULL;
+}
+
+static void _show(void *data)
+{
+ struct _priv *priv;
+
+ if (!data) {
+ _ERR("Get data failed.");
+ return;
+ }
+ priv = data;
+
+ if (priv->base) {
+ evas_object_show(priv->base);
+ layoutmgr_show_layout(priv->lmgr, g_menu_item[E_LAYOUT_DEFAULT].layout_id);
+ }
+}
+
+static void _hide(void *data)
+{
+ struct _priv *priv;
+
+ if (!data) {
+ _ERR("Get data failed.");
+ return;
+ }
+ priv = data;
+
+ if (priv->base)
+ evas_object_hide(priv->base);
+}
+
+static void _update(void *view_data, int update_type, void *data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = data;
+
+ switch (update_type) {
+ case UPDATE_FILE:
+ elm_object_signal_emit(priv->base, SIG_INVISIBLE, SOURCE_ELM);
+ layoutmgr_update_layout(priv->lmgr, g_menu_item[E_LAYOUT_DEFAULT].layout_id,
+ update_type, priv);
+ break;
+
+ case UPDATE_FILE_TO_SELECT:
+ elm_object_signal_emit(priv->base, SIG_VISIBLE, SOURCE_ELM);
+ layoutmgr_update_layout(priv->lmgr, g_menu_item[E_LAYOUT_DEFAULT].layout_id,
+ update_type, priv);
+ break;
+
+ case UPDATE_PATH:
+ update_gengrid(priv);
+ break;
+
+ default:
+ break;
+ }
+
+ return;
+}
+
+static void _destroy(void *data)
+{
+ struct _priv *priv;
+
+ if (!data) {
+ _ERR("Get data failed.");
+ return;
+ }
+ priv = data;
+
+ if (priv->base)
+ evas_object_del(priv->base);
+
+ free(priv);
+}
+
+static view_class _vclass = {
+ .view_id = VIEW_BASE,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .update = _update,
+ .destroy = _destroy,
+};
+
+view_class *view_base_get_vclass(void)
+{
+ return &_vclass;
+}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <app.h>
-#include <Elementary.h>
-#include <viewmgr.h>
-#include <inputmgr.h>
-#include <app_contents.h>
-#include <app_define.h>
-#include <app_debug.h>
-
-#include "define.h"
-#include "utils.h"
-#include "view.h"
-#include "dialog_popup_view.h"
-
-enum menu_type {
- MENU_MYAPPS = 0,
- MENU_APPSTORE,
-};
-
-const char *str_menu[] = {
- STR_MYAPPS,
- NULL
-};
-
-struct _priv {
- Evas_Object *win;
- Evas_Object *base;
- Evas_Object *menu_btn[MENU_COUNT];
- Evas_Object *focused_menu;
- Evas_Object *notify;
- Elm_Object_Item *focused_item;
-};
-
-static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Mouse_Move *ev)
-{
- if (!obj) {
- _ERR("Invalid argument.");
- return;
- }
-
- if (!elm_object_focus_get(obj))
- elm_object_focus_set(obj, EINA_TRUE);
-}
-
-static void _menu_focused_cb(int id, void *data, Evas_Object *obj,
- Elm_Object_Item *item)
-{
- struct _priv *priv;
-
- if (!data || !obj) {
- _ERR("Invalid argument.");
- return;
- }
- priv = data;
-
- if (priv->focused_menu == obj)
- return;
-
- if (priv->focused_menu)
- elm_object_signal_emit(priv->focused_menu,
- SIG_UNSELECTED, SRC_MENU_BTN);
-
- switch (id) {
- case MENU_MYAPPS:
- elm_object_signal_emit(priv->base, SIG_VISIBLE, SRC_MYAPPS);
- break;
-
- case MENU_APPSTORE:
- elm_object_signal_emit(priv->base, SIG_INVISIBLE, SRC_MYAPPS);
- elm_object_part_text_set(priv->base, PART_CONTENTS_TEXT,
- STR_NOT_SUPPORTED);
- /* It will be implemented later. */
- break;
-
- default:
- _ERR("Invalid menu type.");
- return;
- }
-
- priv->focused_menu = obj;
-}
-
-static void _menu_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Key_Down *ev)
-{
- if (!data || !obj || !ev) {
- _ERR("Invalid argument.");
- return;
- }
-}
-
-static input_handler _menu_input_handler = {
- .mouse_move = _mouse_move_cb,
- .focused = _menu_focused_cb,
- .key_down = _menu_key_down_cb
-};
-
-static bool _draw_top_area(struct _priv *priv)
-{
- Evas_Object *box, *btn;
- int i;
-
- elm_object_part_text_set(priv->base, PART_TOP_TITLE, STR_APPS);
-
- box = utils_add_box(priv->base, PART_MENU, EINA_TRUE,
- SIZE_MENU_BOX_PAD_H, SIZE_MENU_BOX_PAD_V);
- if (!box) {
- _ERR("Add box failed.");
- return false;
- }
-
- for (i = 0; i < MENU_COUNT; i++) {
- btn = utils_add_button(priv->base, NULL, str_menu[i],
- STYLE_MENU_BTN);
- if (!btn) {
- _ERR("elm_button_add failed.");
- evas_object_del(box);
- return false;
- }
-
- inputmgr_add_callback(btn, i, &_menu_input_handler, priv);
-
- elm_box_pack_end(box, btn);
-
- priv->menu_btn[i] = btn;
- }
-
- elm_object_focus_next_object_set(priv->menu_btn[0],
- priv->menu_btn[MENU_COUNT - 1], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->menu_btn[MENU_COUNT - 1],
- priv->menu_btn[0], ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(priv->menu_btn[0], priv->menu_btn[0],
- ELM_FOCUS_DOWN);
-
- elm_object_focus_set(priv->menu_btn[0], EINA_TRUE);
-
- return true;
-}
-
-static void _draw_view_content(struct _priv *priv)
-{
- if (!_draw_top_area(priv)) {
- _ERR("Draw top area failed.");
- return;
- }
-}
-
-static Evas_Object *_create(Evas_Object *win, void *data)
-{
- struct _priv *priv;
- Evas_Object *base;
-
- if (!win) {
- _ERR("Get window object failed.");
- return NULL;
- }
-
- priv = calloc(1, sizeof(*priv));
- if (!priv) {
- _ERR("Calloc failed.");
- return NULL;
- }
-
- base = utils_add_layout(win, GRP_VIEW_BASE, EINA_TRUE);
- if (!base) {
- _ERR("Add layout failed.");
- free(priv);
- return NULL;
- }
-
-
- priv->win = win;
- priv->base = base;
-
- if (!viewmgr_set_view_data(VIEW_BASE, priv)) {
- _ERR("Set view data failed.");
- goto end;
- }
-
- _draw_view_content(priv);
-
- return base;
-
-end:
- evas_object_del(base);
- free(priv);
-
- return NULL;
-}
-
-static void _show(void *data)
-{
- struct _priv *priv;
-
- if (!data) {
- _ERR("Get data failed.");
- return;
- }
- priv = data;
-
- if (priv->base)
- evas_object_show(priv->base);
-}
-
-static void _hide(void *data)
-{
- struct _priv *priv;
-
- if (!data) {
- _ERR("Get data failed.");
- return;
- }
- priv = data;
-
- if (priv->base)
- evas_object_hide(priv->base);
-}
-
-static void _update(void *view_data, int update_type, void *data)
-{
- if (!view_data) {
- _ERR("Get data failed.");
- return;
- }
-}
-
-static void _destroy(void *data)
-{
- struct _priv *priv;
-
- if (!data) {
- _ERR("Get data failed.");
- return;
- }
- priv = data;
-
- if (priv->base)
- evas_object_del(priv->base);
-
- free(priv);
-}
-
-static view_class _vclass = {
- .view_id = VIEW_BASE,
- .create = _create,
- .show = _show,
- .hide = _hide,
- .update = _update,
- .destroy = _destroy,
-};
-
-view_class *view_base_get_vclass(void)
-{
- return &_vclass;
-}