[UXIMPL] compression functionality implemented 33/87533/4
authorshubham kumar <shubham.srib@samsung.com>
Thu, 8 Sep 2016 11:44:47 +0000 (17:14 +0530)
committershubham kumar <shubham.srib@samsung.com>
Mon, 12 Sep 2016 07:25:58 +0000 (12:55 +0530)
Change-Id: I7ae63aa11fa0ef7cd433f432e13250cc1b5c0f79
Signed-off-by: shubham kumar <shubham.srib@samsung.com>
28 files changed:
inc/mf-callback.h
inc/mf-compress.h [new file with mode: 0644]
inc/mf-edit-view.h
inc/mf-fs-util.h
inc/mf-main.h
inc/mf-miniunzip.h [new file with mode: 0644]
inc/mf-minizip.h [new file with mode: 0644]
inc/mf-resource.h
inc/mf-util.h
inc/mf-view.h
project_def.prop
src/common/file-operation/mf-compress.c [new file with mode: 0644]
src/common/file-operation/mf-miniunzip.c [new file with mode: 0644]
src/common/file-operation/mf-minizip.c [new file with mode: 0644]
src/common/file-system/mf-file-attr.c
src/common/mf-callback.c
src/common/mf-fm-svc-wrapper.c
src/common/mf-launch.c
src/common/mf-util.c
src/widget/mf-context-popup.c
src/widget/mf-decompress-view.c [new file with mode: 0644]
src/widget/mf-edit-view.c
src/widget/mf-gengrid.c
src/widget/mf-genlist.c
src/widget/mf-navi-bar.c
src/widget/mf-popup.c
src/widget/mf-view.c
tizen-manifest.xml

index 028143f..0d7095c 100755 (executable)
@@ -26,7 +26,6 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event);
 void mfNaviBackStatusSet(void *data, Evas_Object *obj, void *event_info);
 void mfListByCB(void *data, Evas_Object *obj, void *event_info);
 void mf_callback_share_cb(void *data, Evas_Object * obj, void *event_info);
-void mf_callback_cancel_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_edit_cb(void *data, Evas_Object *obj, void *event_info);
 void mf_callback_share_button_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_rename_save_cb(void *ad, Evas_Object * obj, void *event_info);
@@ -36,7 +35,12 @@ void mf_callback_new_folder_create_cb(void *data, Evas_Object *obj, void *event_
 void mf_callback_list_by_view_cb(void *data, Evas_Object *obj, void *event_info);
 void mfMoveCB(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_copy_move_cb(void *data, Evas_Object *obj, void *event_info);
+void* mf_callback_compress_cb(void *data);
+void mf_file_compress_cb(void *data, Evas_Object *obj, void *event_info);
+void mf_callback_decompress_cb(void *data);
+void mf_callback_decompress_done_cb(void *data, Evas_Object *obj, void *event_info);
 void mfSearchbarCancelCallBack(void *data, Evas_Object *obj, void *event_info);
+void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info);
 
 void mf_callback_move_here_cb(void *data, Evas_Object *obj, void *event_info);
 void mf_callback_paste_here_cb(void *data, Evas_Object *obj, void *event_info);
@@ -134,6 +138,11 @@ void mf_callback_move_to_private_button_from_edit_view_cb(void *data, Evas_Objec
 void mf_callback_edit_copy_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_edit_move_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_edit_delete_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_callback_edit_compress_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_callback_edit_decompress_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_callback_compress_replace_cb(void *data , Evas_Object *obj, void *event_info);
+void mf_callback_compress_rename_cb(void *data, Evas_Object *obj, void *event_info);
+void mf_callback_popup_compress_cancel_cb(void *data, Evas_Object *obj, void *event_info);
 void mf_callback_edit_shortcut_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_edit_rename_cb(void *data, Evas_Object * obj, void *event_info);
 void mf_callback_edit_add_to_shortcut_cb(void *data, Evas_Object * obj, void *event_info);
diff --git a/inc/mf-compress.h b/inc/mf-compress.h
new file mode 100644 (file)
index 0000000..a3772ad
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * mf-compress.h
+ *
+ *  Created on: Jul 12, 2016
+ *      Author: piyush.s
+ */
+
+#ifndef MF_COMPRESS_H_
+#define MF_COMPRESS_H_
+
+#include <stdio.h>
+#include <assert.h>
+#include "zlib.h"
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
+#  include <fcntl.h>
+#  include <io.h>
+#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+#  define SET_BINARY_MODE(file)
+#endif
+
+#define CHUNK 16384
+
+
+/* Compress from file source to file dest until EOF on source.
+   def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
+   allocated for processing, Z_STREAM_ERROR if an invalid compression
+   level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
+   version of the library linked do not match, or Z_ERRNO if there is
+   an error reading or writing the files. */
+int def(FILE *source, FILE *dest, int level);
+void compress_file(char *source_name, char *dest_name);
+
+int inf(FILE *source, FILE *dest);
+void decompress_file(char *source_name, char *dest_name);
+
+void zerr(int ret);
+
+
+#endif /* MF_COMPRESS_H_ */
index a213351..a93e117 100755 (executable)
@@ -28,6 +28,10 @@ int mf_edit_file_count_get();
 int mf_edit_folder_list_get_length();
 int mf_edit_file_list_get_length();
 Eina_List *mf_edit_get_all_selected_files();
+
+Eina_List *mf_get_selected_files();
+Eina_List *mf_get_selected_folders();
+
 void mf_edit_select_info_func_set(mf_edit_select_info func);
 void mf_edit_select_all_callback_set(Evas_Smart_Cb func);
 void mf_edit_folder_list_clear();
index 8c2b3ff..cbc5aa3 100755 (executable)
@@ -285,7 +285,8 @@ enum _FILE_TYPE {
        FILE_TYPE_EML,
        FILE_TYPE_CSV,
        FILE_TYPE_SPD,
-       FILE_TYPE_MAX
+       FILE_TYPE_MAX,
+       FILE_TYPE_COMPRESSED
 };
 
 typedef enum _STORAGE MF_STORAGE;
index 757f493..88b7bd1 100755 (executable)
@@ -333,9 +333,13 @@ struct appdata {
        mf_genlist_item_class_s mf_gl_style;
        Eina_List *storage_list;
        Eina_List *file_list;
+       Eina_List *edit_file_list;
        char *nTemp_entry;
        Evas_Object *label;
        char *file_name;
+       char *dir_name;
+       const char *new_file;
+       gchar* launched_file_name;
        int __mf_util_externalStorageId;
        int __mf_util_internalStorageId;
 };
diff --git a/inc/mf-miniunzip.h b/inc/mf-miniunzip.h
new file mode 100644 (file)
index 0000000..0c874a4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * mf-miniunzip.h
+ *
+ *  Created on: Jul 22, 2016
+ *      Author: piyush.s
+ */
+
+#ifndef MF_MINIUNZIP_H_
+#define MF_MINIUNZIP_H_
+
+/*
+   miniunz.c
+   Version 1.01e, February 12th, 2005
+
+   Copyright (C) 1998-2005 Gilles Vollant
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+# include <unistd.h>
+# include <utime.h>
+#include <sys/stat.h>
+
+#include "unzip.h"
+
+#define CASESENSITIVITY (0)
+#define WRITEBUFFERSIZE (8192)
+#define MAXFILENAME (256)
+
+void mf_change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date);
+
+int mf_create_new_dir(const char* dirname);
+
+int mf_do_list(unzFile uf);
+
+int mf_do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password,void *data);
+
+int mf_do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password, void *data);
+
+int mf_do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password, void *data);
+
+
+int mf_do_file_unzip(void *data, int argc, char **argv);
+
+
+#endif /* MF_MINIUNZIP_H_ */
diff --git a/inc/mf-minizip.h b/inc/mf-minizip.h
new file mode 100644 (file)
index 0000000..123e7a3
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * mf-minizip.h
+ *
+ *  Created on: Jul 17, 2016
+ *      Author: piyush.s
+ */
+
+#ifndef MF_MINIZIP_H_
+#define MF_MINIZIP_H_
+
+/*
+   minizip.c
+   Version 1.01e, February 12th, 2005
+
+   Copyright (C) 1998-2005 Gilles Vollant
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+# include <unistd.h>
+# include <utime.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+
+#include <zip.h>
+
+#define WRITEBUFFERSIZE (16384)
+#define MAXFILENAME (256)
+
+int mf_check_exist_file(const char* filename);
+
+/* calculate the CRC32 of a file,
+   because to encrypt a file, we need known the CRC32 of the file before */
+int mf_get_file_crc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc);
+
+int mf_file_do_zip(int argc, char **argv, char *cwd);
+
+#endif /* MF_MINIZIP_H_ */
index 232f250..747968b 100755 (executable)
 #define MF_LABE_HEADER_STORAGE                 "IDS_MF_HEADER_STORAGE_M_MEMORY"
 #define MF_LABEL_RECTENT_FILES                 "IDS_MF_BUTTON2_RECENTLY_VIEWED_M_FILE_ABB"
 #define MF_LABEL_SELECT_ITEMS                  "IDS_MF_HEADER_SELECT_ITEMS"
-#define MF_LABEL_COMPRESS                      "IDS_MF_OPT_ZIP"
+#define MF_LABEL_COMPRESS                      "IDS_MF_OPT_COMPRESS"
 #define LABEL_SORT_BY_CHAP                     "IDS_MF_OPT_SORT_BY"
 #define LABEL_VIEW_AS_CHAP                     "IDS_MF_OPT_VIEW_AS"
 #define MF_SHARE_PROCESSING                    "IDS_MF_POP_PROCESSING_ING"
index 080f56f..c0076be 100755 (executable)
@@ -327,5 +327,7 @@ void mf_util_path_stack_free();
 char *mf_util_first_item_get(char *path);
 int mf_util_get_external_storage_id(void);
 int mf_util_get_internal_storage_id(void);
+void mf_file_decompression_start(void *data);
+void mf_file_compression_start(void *data);
 
 #endif /* __DEF_MYFILE_UTIL_H_ */
index 88d4e7e..5c42324 100755 (executable)
@@ -54,6 +54,7 @@ Elm_Object_Item *mf_view_item_append(Evas_Object *parent, fsNodeInfo *pNode, voi
 void mf_root_view_create(void *data);
 void mf_normal_view_create(void *data);
 void mf_category_view_create(void *data, bool flag_show);
+void mf_decompress_view_create(void *data);
 void mf_view_update(void *data);
 char *mf_view_item_data_get(void *data, int data_type);
 void mf_view_item_remove_by_type(Evas_Object *parent, int storage_type, int view_type);
index d3deab4..a8255e6 100644 (file)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-3.0
 
 # C Sources
-USER_SRCS = src/widget/mf-storage-view.c src/common/file-operation/mf-search.c src/common/mf-media-content.c src/widget/mf-normal-view.c src/widget/mf-tray-item.c src/common/mf-inotify-handle.c src/common/mf-ta.c src/widget/mf-view.c src/widget/mf-search-bar.c src/thumbnail/mf-thumb-gen.c src/common/file-operation/mf-delete-internal.c src/common/mf-error.c src/common/mf-log.c src/common/file-operation/mf-copy.c src/common/file-operation/mf-cancel.c src/widget/mf-object-item.c src/common/mf-media-data.c src/common/file-operation/mf-request.c src/common/mf-ug-detail-media.c src/widget/mf-setting-view.c src/widget/mf-category-view.c src/widget/mf-popup.c src/common/mf-callback.c src/media-db/mf-media-db.c src/common/file-operation/mf-search-internal.c src/widget/mf-object.c src/common/mf-ug-detail-fs.c src/common/file-operation/mf-fo-internal.c src/widget/mf-focus-ui.c src/widget/mf-context-popup.c src/widget/mf-root-view.c src/mf-main.c src/common/mf-detail.c src/widget/mf-edit-view.c src/widget/mf-gengrid.c src/common/file-operation/mf-move.c src/common/file-operation/mf-move-internal.c src/widget/mf-detail-view.c src/common/file-operation/mf-delete.c src/common/mf-storage-space.c src/common/file-system/mf-file-attr.c src/common/mf-util.c src/common/mf-fs-monitor.c src/media-db/mf-media.c src/common/file-system/mf-fs-oper.c src/common/mf-file-util.c src/common/file-operation/mf-copy-internal.c src/widget/mf-search-view.c src/widget/mf-navi-bar.c src/widget/mf-genlist.c src/common/mf-launch.c src/common/mf-fm-svc-wrapper.c src/common/mf-download-app.c src/widget/mf-recent-view.c 
+USER_SRCS = src/widget/mf-storage-view.c src/widget/mf-decompress-view.c src/common/file-operation/mf-search.c src/common/mf-media-content.c src/widget/mf-normal-view.c src/widget/mf-tray-item.c src/common/mf-inotify-handle.c src/common/mf-ta.c src/widget/mf-view.c src/widget/mf-search-bar.c src/thumbnail/mf-thumb-gen.c src/common/file-operation/mf-delete-internal.c src/common/mf-error.c src/common/mf-log.c src/common/file-operation/mf-copy.c src/common/file-operation/mf-cancel.c src/widget/mf-object-item.c src/common/mf-media-data.c src/common/file-operation/mf-request.c src/common/mf-ug-detail-media.c src/widget/mf-setting-view.c src/widget/mf-category-view.c src/widget/mf-popup.c src/common/mf-callback.c src/media-db/mf-media-db.c src/common/file-operation/mf-search-internal.c src/widget/mf-object.c src/common/mf-ug-detail-fs.c src/common/file-operation/mf-fo-internal.c src/widget/mf-focus-ui.c src/widget/mf-context-popup.c src/widget/mf-root-view.c src/mf-main.c src/common/mf-detail.c src/widget/mf-edit-view.c src/widget/mf-gengrid.c src/common/file-operation/mf-move.c src/common/file-operation/mf-move-internal.c src/widget/mf-detail-view.c src/common/file-operation/mf-delete.c src/common/mf-storage-space.c src/common/file-system/mf-file-attr.c src/common/mf-util.c src/common/mf-fs-monitor.c src/media-db/mf-media.c src/common/file-system/mf-fs-oper.c src/common/mf-file-util.c src/common/file-operation/mf-copy-internal.c src/widget/mf-search-view.c src/widget/mf-navi-bar.c src/widget/mf-genlist.c src/common/mf-launch.c src/common/mf-fm-svc-wrapper.c src/common/mf-download-app.c src/widget/mf-recent-view.c src/common/file-operation/mf-minizip.c src/common/file-operation/mf-miniunzip.c
 
 # EDC Sources
 USER_EDCS =  
diff --git a/src/common/file-operation/mf-compress.c b/src/common/file-operation/mf-compress.c
new file mode 100644 (file)
index 0000000..3c5dab9
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * mf-compress.c
+ *
+ *  Created on: Jul 12, 2016
+ *      Author: piyush.s
+ */
+#include "mf-main.h"
+#include "mf-compress.h"
+
+/*void zerr(int ret)
+{
+    fputs("zpipe: ", stderr);
+    switch (ret) {
+    case Z_ERRNO:
+        if (ferror(stdin))
+            fputs("error reading stdin\n", stderr);
+        if (ferror(stdout))
+            fputs("error writing stdout\n", stderr);
+        break;
+    case Z_STREAM_ERROR:
+        fputs("invalid compression level\n", stderr);
+        break;
+    case Z_DATA_ERROR:
+        fputs("invalid or incomplete deflate data\n", stderr);
+        break;
+    case Z_MEM_ERROR:
+        fputs("out of memory\n", stderr);
+        break;
+    case Z_VERSION_ERROR:
+        fputs("zlib version mismatch!\n", stderr);
+    }
+}*/
+
+int def(FILE *source, FILE *dest, int level)
+{
+    int ret, flush;
+    unsigned have;
+    z_stream strm;
+    unsigned char in[CHUNK];
+    unsigned char out[CHUNK];
+
+    /* allocate deflate state */
+    strm.zalloc = Z_NULL;
+    strm.zfree = Z_NULL;
+    strm.opaque = Z_NULL;
+    ret = deflateInit(&strm, level);
+    if (ret != Z_OK)
+        return ret;
+
+    /* compress until end of file */
+    do {
+        strm.avail_in = fread(in, 1, CHUNK, source);
+        if (ferror(source)) {
+            (void)deflateEnd(&strm);
+            return Z_ERRNO;
+        }
+        flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
+        strm.next_in = in;
+
+        /* run deflate() on input until output buffer not full, finish
+           compression if all of source has been read in */
+        do {
+            strm.avail_out = CHUNK;
+            strm.next_out = out;
+            ret = deflate(&strm, flush);    /* no bad return value */
+            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
+            have = CHUNK - strm.avail_out;
+            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
+                (void)deflateEnd(&strm);
+                return Z_ERRNO;
+            }
+        } while (strm.avail_out == 0);
+        assert(strm.avail_in == 0);     /* all input will be used */
+
+        /* done when last data in file processed */
+    } while (flush != Z_FINISH);
+    assert(ret == Z_STREAM_END);        /* stream will be complete */
+
+    /* clean up and return */
+    (void)deflateEnd(&strm);
+    return Z_OK;
+}
+
+
+
+void compress_file(char *source_name, char *dest_name)
+{
+    int ret;
+
+    /* avoid end-of-line conversions */
+    SET_BINARY_MODE(stdin);
+    SET_BINARY_MODE(stdout);
+
+    FILE *source, *dest;
+    source = fopen(source_name, "rb");
+    dest = fopen(dest_name, "wb");
+    ret = def(source, dest, Z_DEFAULT_COMPRESSION);
+    fclose(source);
+    fclose(dest);
+}
+
+
+int inf(FILE *source, FILE *dest)
+{
+    int ret;
+    unsigned have;
+    z_stream strm;
+    unsigned char in[CHUNK];
+    unsigned char out[CHUNK];
+
+    /* allocate inflate state */
+    strm.zalloc = Z_NULL;
+    strm.zfree = Z_NULL;
+    strm.opaque = Z_NULL;
+    strm.avail_in = 0;
+    strm.next_in = Z_NULL;
+    ret = inflateInit(&strm);
+    if (ret != Z_OK)
+        return ret;
+
+    /* decompress until deflate stream ends or end of file */
+    do {
+        strm.avail_in = fread(in, 1, CHUNK, source);
+        if (ferror(source)) {
+            (void)inflateEnd(&strm);
+            return Z_ERRNO;
+        }
+        if (strm.avail_in == 0)
+            break;
+        strm.next_in = in;
+
+        /* run inflate() on input until output buffer not full */
+        do {
+            strm.avail_out = CHUNK;
+            strm.next_out = out;
+            ret = inflate(&strm, Z_NO_FLUSH);
+            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
+            switch (ret) {
+            case Z_NEED_DICT:
+                ret = Z_DATA_ERROR;     /* and fall through */
+            case Z_DATA_ERROR:
+            case Z_MEM_ERROR:
+                (void)inflateEnd(&strm);
+                return ret;
+            }
+            have = CHUNK - strm.avail_out;
+            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
+                (void)inflateEnd(&strm);
+                return Z_ERRNO;
+            }
+        } while (strm.avail_out == 0);
+
+        /* done when inflate() says it's done */
+    } while (ret != Z_STREAM_END);
+
+    /* clean up and return */
+    (void)inflateEnd(&strm);
+    return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
+}
+
+void decompress_file(char *source_name, char *dest_name)
+{
+    int ret;
+
+    /* avoid end-of-line conversions */
+    SET_BINARY_MODE(stdin);
+    SET_BINARY_MODE(stdout);
+
+    FILE *source, *dest;
+    source = fopen(source_name, "rb");
+    dest = fopen(dest_name, "wb");
+    ret = inf(source, dest);
+    fclose(source);
+    fclose(dest);
+}
+
diff --git a/src/common/file-operation/mf-miniunzip.c b/src/common/file-operation/mf-miniunzip.c
new file mode 100644 (file)
index 0000000..603b0c0
--- /dev/null
@@ -0,0 +1,486 @@
+/*
+ * mf-miniunzip.c
+ *
+ *  Created on: Jul 22, 2016
+ *      Author: piyush.s
+ */
+
+/*
+   miniunz.c
+   Version 1.01e, February 12th, 2005
+
+   Copyright (C) 1998-2005 Gilles Vollant
+ */
+
+#include"mf-miniunzip.h"
+#include"mf-dlog.h"
+#include "mf-main.h"
+#include <eina_list.h>
+
+void mf_change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date)
+{
+       struct utimbuf ut;
+       struct tm newdate;
+       newdate.tm_sec = tmu_date.tm_sec;
+       newdate.tm_min=tmu_date.tm_min;
+       newdate.tm_hour=tmu_date.tm_hour;
+       newdate.tm_mday=tmu_date.tm_mday;
+       newdate.tm_mon=tmu_date.tm_mon;
+       if (tmu_date.tm_year > 1900) {
+               newdate.tm_year=tmu_date.tm_year - 1900;
+       } else {
+               newdate.tm_year=tmu_date.tm_year ;
+       }
+       newdate.tm_isdst=-1;
+
+       ut.actime=ut.modtime=mktime(&newdate);
+       utime(filename,&ut);
+}
+
+int mf_create_new_dir(const char* dirname)
+{
+       int ret=0;
+#ifdef unix
+       return mkdir(dirname,0775);
+#endif
+       return ret;
+}
+
+int mf_create_dir(char *newdir)
+{
+       char *buffer ;
+       char *p;
+       int  len = (int)strlen(newdir);
+
+       if (len <= 0) {
+               return 0;
+       }
+
+       buffer = (char*)malloc(len+1);
+       strcpy(buffer,newdir);
+
+       if (buffer[len-1] == '/') {
+               buffer[len-1] = '\0';
+       }
+       if (mf_create_new_dir(buffer) == 0) {
+               free(buffer);
+               return 1;
+       }
+
+       p = buffer+1;
+       while (1) {
+               char hold;
+
+               while(*p && *p != '\\' && *p != '/')
+                       p++;
+               hold = *p;
+               *p = 0;
+               if ((mf_create_new_dir(buffer) == -1) && (errno == ENOENT)) {
+                       mf_debug("couldn't create directory %s\n",buffer);
+                       free(buffer);
+                       return 0;
+               }
+               if (hold == 0) {
+                       break;
+               }
+               *p++ = hold;
+       }
+       free(buffer);
+       return 1;
+}
+
+int mf_do_list(unzFile uf)
+{
+       uLong i;
+       unz_global_info gi;
+       int err;
+
+       err = unzGetGlobalInfo (uf,&gi);
+       if (err!=UNZ_OK)
+               mf_debug("error %d with zipfile in unzGetGlobalInfo \n",err);
+       mf_debug(" Length  Method   Size  Ratio   Date    Time   CRC-32     Name\n");
+       mf_debug(" ------  ------   ----  -----   ----    ----   ------     ----\n");
+       for (i=0;i<gi.number_entry;i++)
+       {
+               char filename_inzip[256];
+               unz_file_info file_info;
+               uLong ratio=0;
+               const char *string_method;
+               char charCrypt=' ';
+               err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+               if (err!=UNZ_OK) {
+                       mf_debug("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+                       break;
+               }
+               if (file_info.uncompressed_size>0) {
+                       ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
+               }
+
+               /* display a '*' if the file is crypted */
+               if ((file_info.flag & 1) != 0) {
+                       charCrypt='*';
+               }
+
+               if (file_info.compression_method==0) {
+                       string_method="Stored";
+               } else if (file_info.compression_method==Z_DEFLATED) {
+                       uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
+                       if (iLevel==0) {
+                               string_method="Defl:N";
+                       } else if (iLevel==1) {
+                               string_method="Defl:X";
+                       } else if ((iLevel==2) || (iLevel==3)) {
+                               string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
+                       }
+               } else {
+                       string_method="Unkn. ";
+               }
+
+               mf_debug("%7lu  %6s%c%7lu %3lu%%  %2.2lu-%2.2lu-%2.2lu  %2.2lu:%2.2lu  %8.8lx   %s\n",
+                               file_info.uncompressed_size,string_method,
+                               charCrypt,
+                               file_info.compressed_size,
+                               ratio,
+                               (uLong)file_info.tmu_date.tm_mon + 1,
+                               (uLong)file_info.tmu_date.tm_mday,
+                               (uLong)file_info.tmu_date.tm_year % 100,
+                               (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
+                               (uLong)file_info.crc,filename_inzip);
+               if ((i+1)<gi.number_entry) {
+                       err = unzGoToNextFile(uf);
+                       if (err!=UNZ_OK) {
+                               mf_debug("error %d with zipfile in unzGoToNextFile\n",err);
+                               break;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+
+int mf_do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password,void *data)
+{
+       char filename_inzip[256];
+       char* filename_withoutpath;
+       char* p;
+       int err=UNZ_OK;
+       FILE *fout=NULL;
+       void* buf;
+       uInt size_buf;
+       int file_found = 0;
+
+       unz_file_info file_info;
+       err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+       struct appdata *ap = (struct appdata *)data;
+
+       Eina_List *temp;
+       void *id;
+
+       EINA_LIST_FOREACH(ap->edit_file_list, temp, id) {
+               if (!strcmp(filename_inzip, (char *)id)) {
+                       file_found = 1;
+                       break;
+               } else {
+                       continue;
+               }
+       }
+
+       if (file_found == 1) {
+               mf_debug("shubham file found");
+               if (err!=UNZ_OK) {
+                       mf_debug("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+                       return err;
+               }
+
+               size_buf = WRITEBUFFERSIZE;
+               buf = (void*)malloc(size_buf);
+               if (buf==NULL) {
+                       mf_debug("Error allocating memory\n");
+                       return UNZ_INTERNALERROR;
+               }
+
+               p = filename_withoutpath = filename_inzip;
+               while ((*p) != '\0') {
+                       if (((*p)=='/') || ((*p)=='\\'))
+                               filename_withoutpath = p+1;
+                       p++;
+               }
+
+               if ((*filename_withoutpath)=='\0') {
+                       if ((*popt_extract_without_path)==0) {
+                               mf_debug("creating directory: %s\n",filename_inzip);
+                               mf_create_new_dir(filename_inzip);
+                       }
+               }
+               else {
+                       const char* write_filename;
+                       int skip=0;
+
+                       if ((*popt_extract_without_path)==0) {
+                               write_filename = filename_inzip;
+                       }
+                       else {
+                               write_filename = filename_withoutpath;
+                       }
+
+                       mf_debug("writefilename is %s", write_filename);
+                       err = unzOpenCurrentFilePassword(uf,password);
+                       if (err!=UNZ_OK) {
+                               mf_debug("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
+                       }
+
+                       if (((*popt_overwrite)==0) && (err==UNZ_OK)) {
+                               char rep=0;
+                               FILE* ftestexist;
+                               ftestexist = fopen(write_filename,"rb");
+                               if (ftestexist!=NULL) {
+                                       fclose(ftestexist);
+                                       do {
+                                               char answer[128];
+                                               memset(answer, 'Y', 128);
+                                               int ret;
+
+                                               mf_debug("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
+                                               rep = answer[0];
+                                               if ((rep>='a') && (rep<='z')) {
+                                                       rep -= 0x20;
+                                               }
+                                       } while ((rep!='Y') && (rep!='N') && (rep!='A'));
+                               }
+
+                               if (rep == 'N') {
+                                       skip = 1;
+                               }
+
+                               if (rep == 'A') {
+                                       *popt_overwrite=1;
+                               }
+                       }
+
+                       if ((skip==0) && (err==UNZ_OK)) {
+                               fout=fopen(write_filename,"wb");
+
+                               /* some zipfile don't contain directory alone before file */
+                               if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
+                                               (filename_withoutpath!=(char*)filename_inzip)) {
+                                       char c=*(filename_withoutpath-1);
+                                       *(filename_withoutpath-1)='\0';
+                                       mf_create_dir(write_filename);
+                                       *(filename_withoutpath-1)=c;
+                                       fout=fopen(write_filename,"wb");
+                               }
+
+                               if (fout==NULL) {
+                                       mf_debug("error opening %s\n",write_filename);
+                               }
+                       }
+
+                       if (fout!=NULL) {
+                               mf_debug(" extracting: %s\n",write_filename);
+
+                               do {
+                                       err = unzReadCurrentFile(uf,buf,size_buf);
+                                       if (err<0) {
+                                               mf_debug("error %d with zipfile in unzReadCurrentFile\n",err);
+                                               break;
+                                       }
+                                       if (err>0) {
+                                               if (fwrite(buf,err,1,fout)!=1) {
+                                                       mf_debug("error in writing extracted file\n");
+                                                       err=UNZ_ERRNO;
+                                                       break;
+                                               }
+                                       }
+                               } while (err>0);
+
+                               if (fout) {
+                                       fclose(fout);
+                               }
+
+                               if (err==0) {
+                                       mf_change_file_date(write_filename,file_info.dosDate,
+                                                       file_info.tmu_date);
+                               }
+                       }
+
+                       if (err==UNZ_OK) {
+                               err = unzCloseCurrentFile (uf);
+                               if (err!=UNZ_OK) {
+                                       mf_debug("error %d with zipfile in unzCloseCurrentFile\n",err);
+                               }
+                       } else {
+                               unzCloseCurrentFile(uf);
+                       }
+               }
+
+               free(buf);
+               return err;
+       } else {
+               return 10;
+       }
+}
+
+
+int mf_do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password, void *data)
+{
+
+       uLong i;
+       unz_global_info gi;
+       int err;
+       FILE* fout=NULL;
+
+       struct appdata *ap = (struct appdata *)data;
+
+       err = unzGetGlobalInfo (uf,&gi);
+       if (err!=UNZ_OK) {
+               mf_debug("error %d with zipfile in unzGetGlobalInfo \n",err);
+       }
+
+
+       for (i=0;i<gi.number_entry;i++)
+       {
+
+               int ret = mf_do_extract_currentfile(uf,&opt_extract_without_path,
+                               &opt_overwrite, password,ap);
+               if (ret != 10 && ret != UNZ_OK) {
+                       break;
+               }
+
+               if ((i+1)<gi.number_entry) {
+                       err = unzGoToNextFile(uf);
+                       if (err!=UNZ_OK) {
+                               mf_debug("error %d with zipfile in unzGoToNextFile\n",err);
+                               break;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+int mf_do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password,void *data)
+{
+       int err = UNZ_OK;
+       struct appdata *ap = (struct appdata *)data;
+       if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) {
+               mf_debug("file %s not found in the zipfile\n",filename);
+               return 2;
+       }
+
+       if (mf_do_extract_currentfile(uf,&opt_extract_without_path,
+                       &opt_overwrite,
+                       password,ap) == UNZ_OK) {
+               return 0;
+       }
+       else {
+               return 1;
+       }
+}
+
+
+int mf_do_file_unzip(void *data, int argc, char **argv)
+{
+       mf_debug("decompression callback called");
+       mf_error("source  : %s", argv[1]);
+       mf_error("Destination  : %s", argv[3]);
+
+       struct appdata *ap = (struct appdata *)data;
+
+       //      chdir(cwd);
+       const char *zipfilename=NULL;
+       const char *filename_to_extract=NULL;
+       const char *password=NULL;
+       char filename_try[MAXFILENAME+16] = "";
+       int i;
+       int opt_do_list=0;
+       int opt_do_extract=1;
+       int opt_do_extract_withoutpath=0;
+       int opt_overwrite=0;
+       int opt_extractdir=0;
+       const char *dirname=NULL;
+       unzFile uf=NULL;
+
+       for (i=1;i<argc;i++) {
+               if ((*argv[i])=='-') {
+                       const char *p=argv[i]+1;
+                       mf_debug("unzip inside if -");
+                       while ((*p)!='\0') {
+                               char c=*(p++);;
+                               if ((c=='l') || (c=='L')) {
+                                       opt_do_list = 1;
+                               }
+                               if ((c=='v') || (c=='V')) {
+                                       opt_do_list = 1;
+                               }
+                               if ((c=='x') || (c=='X')) {
+                                       opt_do_extract = 1;
+                               }
+                               if ((c=='e') || (c=='E')) {
+                                       opt_do_extract = opt_do_extract_withoutpath = 1;
+                               }
+                               if ((c=='o') || (c=='O')) {
+                                       opt_overwrite=1;
+                               }
+                               if ((c=='d') || (c=='D')) {
+                                       opt_extractdir=1;
+                                       dirname=argv[i+1];
+                               }
+
+                               if (((c=='p') || (c=='P')) && (i+1<argc)) {
+                                       password=argv[i+1];
+                                       i++;
+                               }
+                       }
+               } else {
+                       if (zipfilename == NULL) {
+                               mf_debug("unzip zipname is NULL");
+                               zipfilename = argv[i];
+                       } else if ((filename_to_extract==NULL) && (!opt_extractdir)) {
+                               filename_to_extract = argv[i] ;
+                       }
+               }
+       }
+
+
+       dirname = g_strdup(ap->dir_name);
+
+
+       mf_create_new_dir(dirname);
+       if (zipfilename!=NULL) {
+
+               strncpy(filename_try, zipfilename,MAXFILENAME-1);
+               /* strncpy doesnt append the trailing NULL, of the string is too long. */
+               filename_try[ MAXFILENAME ] = '\0';
+
+               uf = unzOpen(zipfilename);
+               if (uf==NULL) {
+                       strcat(filename_try,".zip");
+                       uf = unzOpen(filename_try);
+               }
+       }
+
+       if (uf==NULL) {
+               mf_debug("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
+               return 1;
+       }
+
+       if (opt_do_list==1) {
+               return mf_do_list(uf);
+       } else if (opt_do_extract==1) {
+               if (opt_extractdir && chdir(dirname)) {
+                       mf_debug("Error changing into %s, aborting\n", dirname);
+                       return -1;
+               }
+
+               if (filename_to_extract == NULL) {
+                       return mf_do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password,ap);
+               } else {
+                       return mf_do_extract_onefile(uf,filename_to_extract,
+                                       opt_do_extract_withoutpath,opt_overwrite,password,ap);
+               }
+       }
+       unzCloseCurrentFile(uf);
+       mf_debug("decompression ends here");
+       return 0;
+}
diff --git a/src/common/file-operation/mf-minizip.c b/src/common/file-operation/mf-minizip.c
new file mode 100644 (file)
index 0000000..8b8b7dc
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+ * mf-minizip.c
+ *
+ *  Created on: Jul 17, 2016
+ *      Author: piyush.s
+ */
+
+/*
+   minizip.c
+   Version 1.01e, February 12th, 2005
+
+   Copyright (C) 1998-2005 Gilles Vollant
+ */
+
+#include "mf-minizip.h"
+#include "mf-dlog.h"
+
+uLong mf_get_filetime(char *f,  tm_zip *tmzip, uLong *dt)
+{
+       int ret=0;
+       struct stat s;        /* results of stat() */
+       struct tm* filedate;
+       time_t tm_t=0;
+
+       if (strcmp(f,"-")!=0) {
+               char name[MAXFILENAME+1];
+               int len = strlen(f);
+               if (len > MAXFILENAME)
+                       len = MAXFILENAME;
+
+               strncpy(name, f,MAXFILENAME-1);
+               /* strncpy doesnt append the trailing NULL, of the string is too long. */
+               name[ MAXFILENAME ] = '\0';
+
+               if (name[len - 1] == '/') {
+                       name[len - 1] = '\0';
+               }
+               /* not all systems allow stat'ing a file with / appended */
+               if (stat(name,&s)==0) {
+                       tm_t = s.st_mtime;
+                       ret = 1;
+               }
+       }
+       filedate = localtime(&tm_t);
+
+       tmzip->tm_sec  = filedate->tm_sec;
+       tmzip->tm_min  = filedate->tm_min;
+       tmzip->tm_hour = filedate->tm_hour;
+       tmzip->tm_mday = filedate->tm_mday;
+       tmzip->tm_mon  = filedate->tm_mon ;
+       tmzip->tm_year = filedate->tm_year;
+
+       return ret;
+}
+
+int mf_check_exist_file(filename)
+const char* filename;
+{
+       mf_debug("check exist file");
+       FILE* ftestexist;
+       int ret = 1;
+       ftestexist = fopen(filename,"rb");
+       if (ftestexist==NULL) {
+               ret = 0;
+       } else {
+               fclose(ftestexist);
+       }
+       return ret;
+}
+
+/* calculate the CRC32 of a file,
+   because to encrypt a file, we need known the CRC32 of the file before */
+int mf_get_file_crc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
+{
+       unsigned int calculate_crc=0;
+       int err=ZIP_OK;
+       FILE * fin = fopen(filenameinzip,"rb");
+       unsigned long size_read = 0;
+       unsigned long total_read = 0;
+       if (fin==NULL) {
+               err = ZIP_ERRNO;
+       }
+
+       if (err == ZIP_OK) {
+               do {
+                       err = ZIP_OK;
+                       size_read = (int)fread(buf,1,size_buf,fin);
+                       if (size_read < size_buf)
+                               if (feof(fin)==0)
+                               {
+                                       mf_debug("error in reading %s\n",filenameinzip);
+                                       err = ZIP_ERRNO;
+                               }
+
+                       if (size_read>0)
+                               calculate_crc = crc32(calculate_crc,buf,size_read);
+                       total_read += size_read;
+
+               } while ((err == ZIP_OK) && (size_read>0));
+       }
+
+       if (fin) {
+               fclose(fin);
+       }
+
+       *result_crc=calculate_crc;
+       mf_debug("file %s crc %x\n",filenameinzip,calculate_crc);
+       return err;
+}
+
+int mf_file_do_zip(int argc, char **argv, char *cwd)
+{
+       chdir(cwd);
+       getcwd(cwd, sizeof(cwd));
+       mf_debug("\nCurrent Directory  : %s", cwd);
+       int i;
+       int opt_overwrite=0;
+       int opt_compress_level=Z_DEFAULT_COMPRESSION;
+       int zipfilenamearg = 0;
+       char filename_try[MAXFILENAME+16];
+       int zipok;
+       int err=0;
+       int size_buf=0;
+       void* buf=NULL;
+       const char* password=NULL;
+
+
+       if (argc==1) {
+               mf_debug("argc is 1");
+               return 0;
+       } else {
+               mf_debug("value of argc is %d", argc);
+               for (i = 1; i<argc; i++) {
+                       if ((*argv[i])=='-') {
+                               const char *p=argv[i]+1;
+
+                               while ((*p)!='\0') {
+                                       char c=*(p++);;
+                                       if ((c=='o') || (c=='O')) {
+                                               opt_overwrite = 1;
+                                       }
+                                       if ((c=='a') || (c=='A')) {
+                                               opt_overwrite = 2;
+                                       }
+                                       if ((c>='0') && (c<='9')) {
+                                               opt_compress_level = c-'0';
+                                       }
+
+                                       if (((c=='p') || (c=='P')) && (i+1<argc)) {
+                                               password=argv[i+1];
+                                               i++;
+                                       }
+                               }
+                       }
+                       else if (zipfilenamearg == 0) {
+                               zipfilenamearg = i ;
+                       }
+               }
+       }
+
+       size_buf = WRITEBUFFERSIZE;
+       buf = (void*)malloc(size_buf);
+       if (buf==NULL) {
+               return ZIP_INTERNALERROR;
+       }
+
+       if (zipfilenamearg==0) {
+               zipok=0;
+       } else {
+               int i,len;
+               int dot_found=0;
+
+               zipok = 1 ;
+
+               strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
+               filename_try[ MAXFILENAME ] = '\0';
+
+               len=(int)strlen(filename_try);
+               mf_debug("filename try is %s", filename_try);
+               for (i=len-1;i>=0;i--)
+                       if (filename_try[i]=='.') {
+                               dot_found=1;
+                               break;
+                       }
+
+               if (dot_found==0) {
+                       strcat(filename_try,".zip");
+               } else {
+                       char * ext = strrchr(filename_try, '.');
+                       if (ext) {
+                               *ext = '\0';
+                       }
+                       strcat(filename_try,".zip");
+               }
+
+               if (opt_overwrite==2) {
+                       if (mf_check_exist_file(filename_try)==0) {
+                               mf_debug("file doesnot exist");
+                               opt_overwrite=1;
+                       }
+               }
+       }
+
+       if (zipok==1) {
+               zipFile zf;
+               int errclose;
+               zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
+
+               if (zf == NULL) {
+                       mf_debug("error opening %s",filename_try);
+                       err= ZIP_ERRNO;
+               } else {
+                       mf_debug("creating %s",filename_try);
+               }
+
+               for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
+               {
+                       if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
+                                       ((argv[i][1]=='o') || (argv[i][1]=='O') ||
+                                                       (argv[i][1]=='a') || (argv[i][1]=='A') ||
+                                                       (argv[i][1]=='p') || (argv[i][1]=='P') ||
+                                                       ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
+                                                       (strlen(argv[i]) == 2))) {
+                               FILE * fin;
+                               int size_read;
+                               const char* filenameinzip = argv[i];
+                               zip_fileinfo zi;
+                               unsigned long crcFile=0;
+
+                               zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
+                                               zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
+                               zi.dosDate = 0;
+                               zi.internal_fa = 0;
+                               zi.external_fa = 0;
+                               mf_get_filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
+
+                               if ((password != NULL) && (err==ZIP_OK))
+                                       err = mf_get_file_crc(filenameinzip,buf,size_buf,&crcFile);
+
+                               err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
+                                               NULL,0,NULL,0,NULL /* comment*/,
+                                               (opt_compress_level != 0) ? Z_DEFLATED : 0,
+                                                               opt_compress_level,0,
+                                                               /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
+                                                               -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
+                                                               password,crcFile);
+
+                               if (err != ZIP_OK) {
+                                       mf_debug("error in opening %s in zipfile\n",filenameinzip);
+                               } else {
+                                       fin = fopen(filenameinzip,"rb");
+                                       if (fin==NULL) {
+                                               err=ZIP_ERRNO;
+                                               mf_debug("error in opening %s for reading\n",filenameinzip);
+                                       }
+                               }
+
+                               if (err == ZIP_OK) {
+                                       do {
+                                               err = ZIP_OK;
+                                               size_read = (int)fread(buf,1,size_buf,fin);
+                                               if (size_read < size_buf) {
+                                                       if (feof(fin)==0) {
+                                                               mf_debug("error in reading %s\n",filenameinzip);
+                                                               err = ZIP_ERRNO;
+                                                       }
+                                               }
+
+                                               if (size_read>0)
+                                               {
+                                                       err = zipWriteInFileInZip (zf,buf,size_read);
+                                                       if (err<0)
+                                                       {
+                                                               mf_debug("error in writing %s in the zipfile\n",
+                                                                               filenameinzip);
+                                                       }
+
+                                               }
+                                       } while ((err == ZIP_OK) && (size_read>0));
+                               }
+
+                               if (fin) {
+                                       fclose(fin);
+                               }
+
+                               if (err<0) {
+                                       err=ZIP_ERRNO;
+                               } else {
+                                       err = zipCloseFileInZip(zf);
+                                       if (err!=ZIP_OK) {
+                                               mf_debug("error in closing %s in the zipfile\n",
+                                                               filenameinzip);
+                                       }
+                               }
+                       }
+               }
+               errclose = zipClose(zf,NULL);
+               if (errclose != ZIP_OK) {
+                       mf_debug("error in closing %s\n",filename_try);
+               }
+       }
+       free(buf);
+       return 0;
+}
index f9c65b1..13d40b3 100755 (executable)
@@ -220,7 +220,6 @@ static fsFileType __mf_file_attr_get_category_by_file_ext(const char *file_ext,
        if (file_ext[0] == '.') {
                i = 1;
        }
-
        switch (file_ext[i]) {
        case 'a':
        case 'A':
@@ -539,8 +538,15 @@ static fsFileType __mf_file_attr_get_category_by_file_ext(const char *file_ext,
                        return FILE_TYPE_VIDEO;
                }
                break;
+       case 'z':
+       case 'Z':
+               if (strcasecmp("ZIP", &file_ext[i]) == 0) {
+                       //return FILE_TYPE_COMPRESSED;
+               }
+               break;
        }
 
+
        return FILE_TYPE_ETC;
 }
 
index e5d0681..e4480ef 100755 (executable)
@@ -1,19 +1,19 @@
 /*
-* 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.
-*
-*/
+ * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <stdio.h>
 #include <dbus/dbus.h>
 #include "mf-search-view.h"
 #include "mf-media-content.h"
 
+#include "mf-compress.h"
+#include "mf-minizip.h"
+#include "mf-miniunzip.h"
+#include <string.h>
+
 #include "mf-ug-detail.h"
 #include "mf-file-util.h"
 
 #define MF_SHARE_ITEM_COUNT_MAX 500
 #define MF_POPUP_MENUSTYLE_HEIGHT(x) (52*x)
 #define MF_SORT_BY_ITEM 6
+
+/*#define _WDLOG_PRINT(prio, fmt, args...) \
+               dlog_print( prio, "MYFILES", "%s: %s(%d) > " fmt, _WFILE_NAME, _func_, _LINE_, ##args)
+#define WDEBUG(fmt, args...) _WDLOG_PRINT(DLOG_DEBUG, fmt, ##args)
+ */
+
 struct appdata *temp_data;
 /* mutex for refresh */
 /* mutex for dbus message */
@@ -72,7 +83,10 @@ static Evas_Object *max_length_entry = NULL;
 int g_mf_create_thumbnail_count = 0;
 #define MF_MAX_MAKE_THUNBNAIL_COUNT 10
 
-void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info);
+//static Eina_List *edit_file_list = NULL;
+char new_filename[1000] ={0,};
+char *str[1000] = {0,};
+
 static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage);
 Eina_Bool mf_callback_is_duplicated_without_case(Eina_List *folder_list, char *name);
 
@@ -150,22 +164,22 @@ char *mf_callback_entry_text_get(Evas_Object *entry)
 }
 
 /******************************
-** Prototype    : mf_callback_warning_popup_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_warning_popup_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_warning_popup_cb(void *data, Evas_Object *obj, void *event_info)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -181,21 +195,21 @@ void mf_callback_warning_popup_cb(void *data, Evas_Object *obj, void *event_info
 }
 
 /******************************
-** Prototype    : mf_callback_app_rotate_cb
-** Description  :
-** Input        : enum appcore_rm mode
-**                void *data
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_app_rotate_cb
+ ** Description  :
+ ** Input        : enum appcore_rm mode
+ **                void *data
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event)
 {
        MF_TRACE_BEGIN;
@@ -220,7 +234,7 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event)
                        break;
                }
                ug_send_event(new_event);
-       */
+        */
        const char *config = elm_config_profile_get();
        if (!strcmp(config, "desktop")) {
                return;
@@ -239,10 +253,10 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event)
        } else {
                if (changed_angle == APP_DEVICE_ORIENTATION_90 || changed_angle == APP_DEVICE_ORIENTATION_270) {
                        evas_object_size_hint_min_set(ap->mf_MainWindow.pPopupBox, -1,
-                                                     ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM / 2)));
+                                       ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM / 2)));
                } else {
                        evas_object_size_hint_min_set(ap->mf_MainWindow.pPopupBox, -1,
-                                                     ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM)));
+                                       ELM_SCALE_SIZE(MF_POPUP_MENUSTYLE_HEIGHT(MF_SORT_BY_ITEM)));
                }
                if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_recent && ap->mf_Status.view_type != mf_view_storage) {
                        mf_navi_bar_pathinfo_refresh(ap);
@@ -257,22 +271,22 @@ void mf_callback_app_rotate_cb(void *data, Evas_Object *obj, void *event)
 }
 
 /******************************
-** Prototype    : click_callback
-** Description  :
-** Input        : struct appdata* data
-**                mfAction key
-**                GString* path
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : click_callback
+ ** Description  :
+ ** Input        : struct appdata* data
+ **                mfAction key
+ **                GString* path
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_upper_click_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -398,22 +412,22 @@ void mf_callback_click_cb(struct appdata *data, mfAction key, GString *path)
 }
 
 /******************************
-** Prototype    : mf_callback_illegal_char_popup_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_illegal_char_popup_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_illegal_char_popup_cb(void *data, Evas_Object *obj, void *event_info)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -442,22 +456,36 @@ void mf_callback_illegal_char_popup_cb(void *data, Evas_Object *obj, void *event
 }
 
 /******************************
-** Prototype    : mf_callback_cancel_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_cancel_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
+
+void mf_rename_done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+
+
+
+       ap->new_file = strdup(elm_entry_entry_get(ap->mf_MainWindow.pEntry));
+
+       mf_debug("entry content is %s", ap->new_file);
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       mf_file_compression_start(ap);
+}
+
 void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -466,7 +494,7 @@ void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info)
        mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL");
        mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL");
 
-       mf_error("more is [%d]", ap->mf_Status.more);
+       mf_error("more is [%d], extra is [%d]", ap->mf_Status.more, ap->mf_Status.extra);
 
        Evas_Object *newContent;
        //mf_object_enable_virtualkeypad();
@@ -518,6 +546,8 @@ void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info)
                break;
        case MORE_EDIT:
        case MORE_EDIT_COPY:
+       case MORE_COMPRESS:
+       case MORE_DECOMPRESS:
        case MORE_EDIT_MOVE:
        case MORE_EDIT_DELETE:
        case MORE_EDIT_DETAIL:
@@ -631,17 +661,17 @@ void mf_callback_cancel_cb(void *data, Evas_Object *obj, void *event_info)
 
        if (ap->mf_Status.view_type != mf_view_root) {
                mf_navi_add_back_button(ap, mf_callback_navi_backbutton_clicked_cb);
-//             Evas_Object *pImage = elm_image_add(ap->mf_MainWindow.pNaviLayout);
-//             elm_image_file_set(pImage, EDJ_IMAGE, MF_ICON_SOFT_BACK);
-//             elm_image_resizable_set(pImage, EINA_TRUE, EINA_TRUE);
-//             evas_object_show(pImage);
-//
-//             Evas_Object *btn = elm_button_add(ap->mf_MainWindow.pNaviLayout);
-//             elm_object_content_set(btn,pImage);
-//             elm_object_style_set(btn, "transparent");
-//             evas_object_smart_callback_add(btn, "clicked", mf_callback_backbutton_clicked_cb, ap);
-//             //elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "back_key", btn);
-//             elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "title_left_btn", btn);
+               //              Evas_Object *pImage = elm_image_add(ap->mf_MainWindow.pNaviLayout);
+               //              elm_image_file_set(pImage, EDJ_IMAGE, MF_ICON_SOFT_BACK);
+               //              elm_image_resizable_set(pImage, EINA_TRUE, EINA_TRUE);
+               //              evas_object_show(pImage);
+               //
+               //              Evas_Object *btn = elm_button_add(ap->mf_MainWindow.pNaviLayout);
+               //              elm_object_content_set(btn,pImage);
+               //              elm_object_style_set(btn, "transparent");
+               //              evas_object_smart_callback_add(btn, "clicked", mf_callback_backbutton_clicked_cb, ap);
+               //              //elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "back_key", btn);
+               //              elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "title_left_btn", btn);
        }
 
        if (ap->mf_Status.more == MORE_DEFAULT) {
@@ -667,22 +697,22 @@ void mf_callback_unsupported_app_cb(void *data, Evas_Object *obj, void *event_in
 }
 
 /******************************
-** Prototype    : __mf_popup_show_vk_cb
-** Description  : Samsung
-** Input        : void *data
-**                Evas_Object * obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : __mf_popup_show_vk_cb
+ ** Description  : Samsung
+ ** Input        : void *data
+ **                Evas_Object * obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_popup_show_vk_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -821,22 +851,22 @@ static void __mf_callback_refresh_rename(void *data, GString *pre_name, GString
 }
 
 /******************************
-** Prototype    : mf_callback_rename_save_cb
-** Description  :
-** Input        : void *ad
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_rename_save_cb
+ ** Description  :
+ ** Input        : void *ad
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 static int __mf_callback_idle_rename_refresh(void *data)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -1050,7 +1080,7 @@ void mf_callback_rename_save_cb(void *ad, Evas_Object *obj, void *event_info)
        } else {
                goto NORMAL_EXIT;
        }
-NORMAL_EXIT:
+       NORMAL_EXIT:
        SAFE_FREE_CHAR(strstrip_name);
        SAFE_FREE_CHAR(pName);
        SAFE_FREE_CHAR(pFullPath);
@@ -1060,7 +1090,7 @@ NORMAL_EXIT:
        MF_TRACE_END;
        return;
 
-INVAILD_NAME_EXIT:
+       INVAILD_NAME_EXIT:
        SAFE_FREE_CHAR(strstrip_name);
        SAFE_FREE_CHAR(pName);
        SAFE_FREE_CHAR(pFullPath);
@@ -1078,7 +1108,7 @@ INVAILD_NAME_EXIT:
                //ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,LABEL_CANCEL, MF_BUTTON_LABEL_OK, NULL, mf_callback_illegal_char_popup_cb, ap);
                mf_callback_entry_unfocus(pEntry);
                mf_popup_second_popup_create(ap, ap->mf_MainWindow.pWindow, message,
-                                            MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap);
+                               MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap);
                mf_callback_monitor_media_db_update_flag_set(EINA_FALSE);
                mf_callback_monitor_internal_update_flag_set(EINA_FALSE);
                return;
@@ -1091,7 +1121,7 @@ INVAILD_NAME_EXIT:
        MF_TRACE_END;
        return;
 
-ALLOC_FAILED_EXIT:
+       ALLOC_FAILED_EXIT:
        SAFE_FREE_CHAR(strstrip_name);
        SAFE_FREE_CHAR(pName);
        SAFE_FREE_CHAR(pFullPath);
@@ -1104,22 +1134,22 @@ ALLOC_FAILED_EXIT:
 }
 
 /******************************
-** Prototype    : mf_callback_rename_save_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_rename_save_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_popup_error_exit_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -1253,13 +1283,13 @@ void mf_callback_new_folder_save_cb(void *data, Evas_Object *obj, void *event_in
        SAFE_FREE_CHAR(name);
        return;
 
-ERROR_WARNING_EXIT:
+       ERROR_WARNING_EXIT:
        SAFE_FREE_CHAR(name);
        SAFE_FREE_CHAR(fullpath);
        mf_callback_entry_unfocus(ap->mf_MainWindow.pEntry);
        mf_popup_warning_popup_create(ap, ap->mf_MainWindow.pWindow, MF_POP_MAX_WARNING_TITEL, message, MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap);
        return;
-ERROR_EXIT_CREATE:
+       ERROR_EXIT_CREATE:
        SAFE_FREE_CHAR(name);
        SAFE_FREE_CHAR(fullpath);
        ap->mf_Status.more = ap->mf_Status.pre_create_more;
@@ -1268,7 +1298,7 @@ ERROR_EXIT_CREATE:
        ap->mf_MainWindow.pEntry = NULL;
        SAFE_FREE_OBJ(ap->mf_MainWindow.pNewFolderPopup);
        ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, message,
-                                        MF_BUTTON_LABEL_OK, NULL, NULL, mf_popup_error_exit_cb, ap);
+                       MF_BUTTON_LABEL_OK, NULL, NULL, mf_popup_error_exit_cb, ap);
 
        return;
 
@@ -1286,22 +1316,22 @@ void mf_callback_popup_deleted_cb(void *data, Evas_Object *obj, void *event_info
 }
 
 /******************************
-** Prototype    : __mf_callback_list_by_response_cb
-** Description  : Samsung
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : __mf_callback_list_by_response_cb
+ ** Description  : Samsung
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_list_by_response_cb(void *data, Evas_Object *obj, void *event_info)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -1325,22 +1355,22 @@ void mf_callback_list_by_response_cb(void *data, Evas_Object *obj, void *event_i
 }
 
 /******************************
-** Prototype    : mf_callback_list_by_view_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_list_by_view_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_list_by_view_cb(void *data, Evas_Object *obj, void *event_info)
 {
        mf_debug();
@@ -1354,22 +1384,22 @@ void mf_callback_list_by_view_cb(void *data, Evas_Object *obj, void *event_info)
 }
 
 /******************************
-** Prototype    : mf_callback_edit_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_edit_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 static void __mf_callback_save_edit_view_status(void *data)
 {
        MF_TRACE_BEGIN;
@@ -1528,21 +1558,64 @@ void mf_callback_edit_delete_cb(void *data, Evas_Object *obj, void *event_info)
        MF_TRACE_END;
 }
 
-void mf_callback_edit_shortcut_cb(void *data, Evas_Object *obj, void *event_info)
+void mf_callback_edit_compress_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
        struct appdata *ap = (struct appdata *)data;
        mf_retm_if(ap == NULL, "ap is NULL");
        SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
        SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup);
+       if (ap->mf_MainWindow.pButton) {
+               elm_object_part_content_unset(ap->mf_MainWindow.pNaviLayout, "search_icon");
+               evas_object_hide(ap->mf_MainWindow.pButton);
+       }
 
-       ap->mf_Status.more = MORE_EDIT_ADD_SHORTCUT;
+       if (ap->mf_Status.more == MORE_SEARCH) {
+               if (ap->mf_MainWindow.pNaviSearchBar) {
+                       elm_object_signal_emit(ap->mf_MainWindow.pNaviLayout, "hide", "search_bar");
+                       elm_object_signal_emit(ap->mf_MainWindow.pNaviLayout, "show", "elm.swallow.content");
+                       //ap->mf_Status.extra = MORE_SHARE_EDIT;
+               }
+       } else {
+               ap->mf_Status.extra = MORE_SHARE_EDIT;
+       }
+       ap->mf_Status.more = MORE_COMPRESS;
        __mf_callback_edit_share_view(ap);
 
        /*disable all the tab item if tab exists */
        MF_TRACE_END;
 }
 
+void mf_callback_edit_decompress_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       MF_TRACE_BEGIN;
+       struct appdata *ap = (struct appdata *)data;
+       mf_retm_if(ap == NULL, "ap is NULL");
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup);
+       if (ap->mf_MainWindow.pButton) {
+               elm_object_part_content_unset(ap->mf_MainWindow.pNaviLayout, "search_icon");
+               evas_object_hide(ap->mf_MainWindow.pButton);
+       }
+
+       if (ap->mf_Status.more == MORE_SEARCH) {
+               if (ap->mf_MainWindow.pNaviSearchBar) {
+                       elm_object_signal_emit(ap->mf_MainWindow.pNaviLayout, "hide", "search_bar");
+                       elm_object_signal_emit(ap->mf_MainWindow.pNaviLayout, "show", "elm.swallow.content");
+                       //ap->mf_Status.extra = MORE_SHARE_EDIT;
+               }
+       } else {
+               ap->mf_Status.extra = MORE_SHARE_EDIT;
+       }
+       ap->mf_Status.more = MORE_DECOMPRESS;
+       __mf_callback_edit_share_view(ap);
+
+       /*disable all the tab item if tab exists */
+       MF_TRACE_END;
+
+
+}
+
 void mf_callback_edit_rename_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -1645,7 +1718,7 @@ void mf_callback_do_delete_shortcut_cb(void *data, Evas_Object *obj, void *event
                EINA_LIST_FOREACH(selected_list, l, it) {
                        if (it) {
                                item_data = elm_object_item_data_get(it);
-                                       {
+                               {
                                        mfItemData_s *select_item = (mfItemData_s *)item_data;
                                        if (select_item && select_item->m_ItemName && select_item->m_ItemName->str) {
                                                mf_util_db_remove_shortcut(ap->mf_MainWindow.mfd_handle, select_item->m_ItemName->str);
@@ -1667,12 +1740,12 @@ void mf_callback_delete_shortcut_confirm_cb(void *data, Evas_Object *obj, void *
        int count = mf_edit_file_count_get();
        if (count > 1) {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_DELETE_SHORTCUT,
-                                                                      MF_LABEL_DELETE_SHORTCUTS_Q,
-                                                                      LABEL_CANCEL, LABEL_DELETE, mf_callback_do_delete_shortcut_cb, ap, count);
+                               MF_LABEL_DELETE_SHORTCUTS_Q,
+                               LABEL_CANCEL, LABEL_DELETE, mf_callback_do_delete_shortcut_cb, ap, count);
        } else {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_DELETE_ITEM,
-                                                                      MF_LABEL_DELETE_THIS_SHORTCUT,
-                                                                      LABEL_CANCEL, LABEL_DELETE, mf_callback_do_delete_shortcut_cb, ap, count);
+                               MF_LABEL_DELETE_THIS_SHORTCUT,
+                               LABEL_CANCEL, LABEL_DELETE, mf_callback_do_delete_shortcut_cb, ap, count);
        }
 }
 
@@ -1741,12 +1814,12 @@ void mf_callback_delete_recent_files_confirm_cb(void *data, Evas_Object *obj, vo
        int count = mf_edit_file_count_get();
        if (count > 1) {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_REMOVE,
-                                                       MF_LABEL_DELETE_RECENT_Q,
-                                                       LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count);
+                               MF_LABEL_DELETE_RECENT_Q,
+                               LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count);
        } else {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_REMOVE,
-                                                       MF_LABEL_DELETE_THIS_RECENT,
-                                                       LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count);
+                               MF_LABEL_DELETE_THIS_RECENT,
+                               LABEL_CANCEL, MF_LABEL_REMOVE, mf_callback_do_delete_recent_files, ap, count);
        }
 }
 
@@ -1756,7 +1829,7 @@ void mf_callback_do_add_to_shortcut_cb(void *data, Evas_Object *obj, void *event
        mf_retm_if(data == NULL, "data is NULL");
        struct appdata *ap = (struct appdata *)data;
 
-               {
+       {
                int location = mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str);
                bool find = mf_util_db_find_shortcut(ap->mf_MainWindow.mfd_handle, ap->mf_Status.path->str, mf_file_get(ap->mf_Status.path->str), location);
                mf_error("find is [%d]", find);
@@ -1787,24 +1860,24 @@ void mf_callback_edit_unintall_cb(void *data, Evas_Object *obj, void *event_info
 }
 
 /******************************
-** Prototype    : mf_callback_icu_update_cb
-** Description  :
-** Input        : void *data
-** Output       : int
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2011/06/30
-**    Author       : Samsung
-**    Modification : Created function
-**/
+ ** Prototype    : mf_callback_icu_update_cb
+ ** Description  :
+ ** Input        : void *data
+ ** Output       : int
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2011/06/30
+ **    Author       : Samsung
+ **    Modification : Created function
+ **/
 void mf_callback_icu_update_cb(app_event_info_h event_info, void *data)
 {
        /*
                ug_send_event(UG_EVENT_REGION_CHANGE);
-       */
+        */
        mf_debug("region changed");
        assert(data);
        struct appdata *ap = (struct appdata *)data;
@@ -1839,22 +1912,22 @@ void mf_callback_icu_update_cb(app_event_info_h event_info, void *data)
 }
 
 /******************************
-** Prototype    : mf_callback_new_folder_create_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_new_folder_create_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_new_folder_create_cb(void *data, Evas_Object *obj, void *event_info)
 {
        mf_debug();
@@ -1959,7 +2032,7 @@ void mf_callback_long_clicked_cb(void *data, Evas_Object *obj, void *event_info)
        struct appdata *ap = (struct appdata *)data;
        mf_retm_if(ap == NULL, "ap is NULL");
        evas_object_smart_callback_del(ap->mf_MainWindow.pEntry, "clicked", (Evas_Smart_Cb) mf_callback_clicked_cb);
-//     elm_entry_select_none(ap->mf_MainWindow.pEntry);
+       //      elm_entry_select_none(ap->mf_MainWindow.pEntry);
        MF_TRACE_END;
 }
 
@@ -1978,20 +2051,20 @@ void mf_callback_max_len_reached_cb(void *data, Evas_Object *obj, void *event_in
 }
 
 /******************************
-** Prototype    : mf_callback_init_operation_cancel
-** Description  : Samsung
-** Input        : void *data
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_init_operation_cancel
+ ** Description  : Samsung
+ ** Input        : void *data
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_init_operation_cancel(void *data)
 {
        MF_TRACE_BEGIN;
@@ -2008,20 +2081,20 @@ void mf_callback_init_operation_cancel(void *data)
 }
 
 /******************************
-** Prototype    : __mf_callback_idle_refresh
-** Description  : Samsung
-** Input        : void *data
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : __mf_callback_idle_refresh
+ ** Description  : Samsung
+ ** Input        : void *data
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 static int __mf_callback_idle_refresh(void *data)
 {
        MF_TRACE_BEGIN;
@@ -2034,20 +2107,20 @@ static int __mf_callback_idle_refresh(void *data)
 }
 
 /******************************
-** Prototype    : __mf_callback_progress_bar_state_cb
-** Description  : Samsung
-** Input        : void *data
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : __mf_callback_progress_bar_state_cb
+ ** Description  : Samsung
+ ** Input        : void *data
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_progress_bar_state_cb(void *data)
 {
        MF_TRACE_BEGIN;
@@ -2066,7 +2139,7 @@ void mf_callback_progress_bar_state_cb(void *data)
        total_count = ap->mf_FileOperation.iTotalCount;
        count = msg->current_index;
        mf_error("processing ,current_size[%d], total_size[%ld]", msg->current_size,
-                msg->total_size);
+                       msg->total_size);
        value = (double)msg->current_size / msg->total_size;
        //add protection to avoid the percent passed 100%
        if (value > 1 && count <= total_count) {
@@ -2108,22 +2181,22 @@ void mf_callback_progress_bar_state_cb(void *data)
 }
 
 /******************************
-** Prototype    : mf_callback_progress_bar_cancel_cb
-** Description  : Samsung
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_progress_bar_cancel_cb
+ ** Description  : Samsung
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_progress_bar_cancel_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2137,22 +2210,22 @@ void mf_callback_progress_bar_cancel_cb(void *data, Evas_Object *obj, void *even
 }
 
 /******************************
-** Prototype    : mfCopyCB
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mfCopyCB
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_item_copy_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2215,6 +2288,303 @@ void mf_callback_item_move_cb(void *data, Evas_Object *obj, void *event_info)
        MF_TRACE_END;
 }
 
+void * mf_callback_compress_cb(void *data)
+{
+       MF_TRACE_BEGIN;
+       struct appdata *ap = (struct appdata *)data;
+       if (ap == NULL)
+               return NULL;
+
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
+
+
+       Eina_List *folder_list = NULL, *file_list = NULL;
+       Eina_List *l = NULL;
+       GString *it = NULL;
+       Eina_List *source_folder_list = NULL, *source_file_list = NULL;
+       if (ap->mf_FileRecordList.value_saver != NULL) {
+
+               mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
+               ap->mf_FileRecordList.value_saver = NULL;
+       }
+       ap->mf_FileRecordList.value_saver = mf_edit_get_all_selected_files();
+       if (ap->mf_FileOperation.source != NULL) {
+               g_string_free(ap->mf_FileOperation.source, TRUE);
+               ap->mf_FileOperation.source = NULL;
+       }
+       ap->mf_FileOperation.source = g_string_new(ap->mf_Status.path->str);
+
+       if (source_folder_list != NULL) {
+               mf_util_free_eina_list_with_data(&source_folder_list, MYFILE_TYPE_GSTRING);
+               source_folder_list = NULL;
+       }
+       source_folder_list = mf_get_selected_folders();
+
+
+       if (source_file_list != NULL) {
+               mf_util_free_eina_list_with_data(&source_file_list, MYFILE_TYPE_GSTRING);
+               source_file_list = NULL;
+       }
+       source_file_list = mf_get_selected_files();
+
+
+       char *dest_name;
+
+       if (!ap->new_file) {
+               if(mf_util_get_eina_list_len(source_file_list) + mf_util_get_eina_list_len(source_folder_list) == 1){
+                       if(mf_util_get_eina_list_len(source_file_list) == 1){
+                               l = source_file_list;
+
+                       }
+                       if(mf_util_get_eina_list_len(source_folder_list) == 1){
+                               l = source_folder_list;
+                       }
+                       it = eina_list_data_get(l);
+                       dest_name = g_strdup(it->str);
+               } else{
+                       dest_name = g_strdup(ap->mf_FileOperation.source->str);
+               }
+
+               dest_name = strrchr(dest_name, '/');
+               dest_name++;
+       } else {
+               dest_name = strdup(ap->new_file);
+       }
+
+       if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) {
+               ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED,
+                               MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
+               return NULL;
+       }
+
+       EINA_LIST_FOREACH(source_folder_list, l, it){
+               if (folder_list) {
+                       mf_util_free_eina_list_with_data(&(folder_list), MYFILE_TYPE_FSNODE);
+               }
+               if (file_list) {
+                       mf_util_free_eina_list_with_data(&(file_list), MYFILE_TYPE_FSNODE);
+               }
+               if(it && it->str){
+                       mf_util_generate_list_data(it->str, &folder_list, &file_list);
+                       mf_error("\n%s:", it->str);
+               }
+
+               Eina_List *l2 = NULL;
+               fsNodeInfo *pNode2 = NULL;
+               for (l2 = folder_list, pNode2 = eina_list_data_get(l2); l2; l2 = eina_list_next(l2), pNode2 = eina_list_data_get(l2)){
+                       if(pNode2 && pNode2->name){
+                               char *real_name = g_strconcat(pNode2->path, "/", pNode2->name, NULL);
+                               GString *pTemp = g_string_new(real_name);
+                               source_folder_list = eina_list_append(source_folder_list, pTemp);
+                               mf_error("\n>>>%s", real_name);
+                       }
+               }
+               for (l2 = file_list, pNode2 = eina_list_data_get(l2); l2; l2 = eina_list_next(l2), pNode2 = eina_list_data_get(l2)){
+                       if(pNode2 && pNode2->name){
+                               char *real_name = g_strconcat(pNode2->path, "/", pNode2->name, NULL);
+                               GString *pTemp = g_string_new(real_name);
+                               source_file_list = eina_list_append(source_file_list, pTemp);
+
+                               mf_error("\n>>>%s", real_name);
+                       }
+               }
+
+       }
+
+       EINA_LIST_FOREACH(source_file_list, l, it) {
+               if (it && it->str) {
+                       mf_error("\nFiles  : %s", it->str);
+               }
+               else{
+                       mf_error("\nFiles  : %d", 0);
+               }
+       }
+
+       int argc = mf_util_get_eina_list_len(source_file_list) + 2;
+       char **argv = (char **)malloc(argc*sizeof(char *));
+       argv[0] = (char*)malloc(sizeof(char)*10);
+       strcpy(argv[0], "minizip");
+       argv[1] = (char*)malloc(sizeof(char)*strlen(dest_name));
+       strcpy(argv[1], dest_name);
+       int i = 2;
+       EINA_LIST_FOREACH(source_file_list, l, it){
+               char *source_name = g_strdup(it->str);
+               int n = strlen(ap->mf_FileOperation.source->str) + 1;
+               source_name += n;
+               argv[i] = (char*)malloc(sizeof(char)*strlen(source_name));
+               strcpy(argv[i], source_name);
+               i++;
+       }
+
+       mf_file_do_zip(argc, argv, ap->mf_FileOperation.source->str);
+
+       ap->mf_Status.view_type = mf_view_normal;
+       mf_debug("thread function done");
+       //      ap->new_file = NULL;
+       MF_TRACE_END;
+       pthread_exit(0);
+       return NULL;
+}
+
+void mf_callback_compress_replace_cb(void *data , Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       mf_file_compression_start(ap);
+}
+
+void mf_callback_compress_rename_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+
+       Evas_Object *popup;
+       popup = elm_popup_add(ap->mf_MainWindow.pMainLayout);
+       elm_object_signal_emit(popup, "elm,action,center_popup,entry", "");
+
+       Evas_Object *layout = mf_popup_entry_layout_create(popup);
+       elm_object_content_set(popup, layout);
+
+       Evas_Object *en = NULL;
+       en = mf_popup_entry_create(layout);
+       elm_object_part_content_set(layout, "elm.swallow.content", en);
+
+       char *text = strdup(str);
+
+       text = strrchr(text,'/');
+       text++;
+       char * ext = strrchr(text, '.');
+       if(ext){
+               *ext = '\0';
+       }
+
+       elm_entry_entry_set(en, text);
+       elm_entry_select_all(en);
+
+       mf_object_text_set(popup, LABEL_RENAME_CHAP, "title,text");
+
+       Evas_Object *btn1 = mf_object_create_button(popup,
+                       NULL, //"popup_button/default",
+                       LABEL_CANCEL,
+                       NULL,
+                       mf_callback_cancel_cb,
+                       ap,
+                       EINA_FALSE);
+
+       Evas_Object *btn2 = mf_object_create_button(popup,
+                       NULL, //"popup_button/default",
+                       LABEL_RENAME,//Change MF_LABEL_DONE to MF_BUTTON_LABEL_OK for fixing(P131029-02752).
+                       NULL,
+                       mf_rename_done_cb,
+                       ap,
+                       EINA_FALSE);
+
+       elm_object_part_content_set(popup, "button1", btn1);
+       elm_object_part_content_set(popup, "button2", btn2);
+
+       evas_object_show(popup);
+       //      evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, mf_popup_new_folder_del_cb, ap);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+       //      evas_object_data_set(popup, "item_data", params);
+       elm_entry_cursor_end_set(en);
+       ap->mf_MainWindow.pEntry = en;
+       ap->mf_MainWindow.pNormalPopup = popup;
+       //      evas_object_show(en);
+       //      mf_file_compression_start(ap);
+}
+
+void mf_callback_decompress_cb(void *data)
+{
+       MF_TRACE_BEGIN;
+       struct appdata *ap = (struct appdata *)data;
+       mf_retm_if(ap == NULL, "ap is NULL");
+       unzFile uf=NULL;
+       int i;
+
+       if (ap->mf_FileOperation.source != NULL) {
+               g_string_free(ap->mf_FileOperation.source, TRUE);
+               ap->mf_FileOperation.source = NULL;
+       }
+       ap->mf_FileOperation.source = g_string_new(ap->mf_Status.path->str);
+
+       int argc = 4;
+       char **argv = (char **)malloc(argc*sizeof(char *));
+       argv[0] = (char*)malloc(sizeof(char)*15);
+       strcpy(argv[0], "miniunzip");
+
+       if(!ap->launched_file_name) {
+               mf_debug("Null File Name");
+       }
+
+       char *source_name = g_strdup(ap->launched_file_name);
+       char *dest_name = g_strdup(ap->launched_file_name);
+
+       mf_debug("dest name is %s", dest_name);
+
+
+
+       uf = unzOpen(source_name);
+       if (uf==NULL) {
+               strcat(source_name,".zip");
+               uf = unzOpen(source_name);
+       }
+
+       if(uf == NULL) {
+               mf_debug("unable to extract files");
+       }
+
+       unz_global_info gi;
+       int err;
+       char filename_inzip[256];
+       unz_file_info file_info;
+       err = unzGetGlobalInfo (uf,&gi);
+
+       if(gi.number_entry == 0) {
+               //TODO show error message
+               return;
+       }
+
+       for (i=0;i<gi.number_entry;i++) {
+               err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+               mf_debug("files in zipped are %s", filename_inzip);
+               if (i+1 < gi.number_entry) {
+                       err = unzGoToNextFile(uf);
+                       if (err!=UNZ_OK) {
+                               mf_debug("error %d with zipfile in unzGoToNextFile\n",err);
+                               break;
+                       }
+               }
+       }
+
+       mf_error("Source  : %s", source_name);
+       argv[1] = (char*)malloc(sizeof(char)*strlen(source_name));
+       strcpy(argv[1], source_name);
+       argv[2] = (char*)malloc(sizeof(char)*10);
+       strcpy(argv[2], "-d");
+       argv[3] = (char*)malloc(sizeof(char)*strlen(dest_name));
+       strcpy(argv[3], dest_name);
+       mf_do_file_unzip(ap,argc, argv);
+
+       mf_error("\nMORE : %d. EXTRA : %d", ap->mf_Status.more, ap->mf_Status.extra);
+
+       if (ap->mf_Status.extra == MORE_SEARCH) {
+               ap->mf_Status.more = MORE_SEARCH;
+               mf_search_view_create(ap);
+       } else {
+               ap->mf_Status.more = MORE_DEFAULT;
+               SAFE_FREE_CHAR(ap->mf_Status.entry_path);
+               ap->mf_Status.entry_more = MORE_DEFAULT;
+               if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.more != MORE_SEARCH) {
+                       mf_navi_bar_recover_info_box(ap);
+               }
+               mf_naviframe_title_button_delete(ap->mf_MainWindow.pNaviItem);
+       }
+
+
+       ap->mf_Status.view_type = mf_view_normal;
+       MF_TRACE_END;
+}
+
 void mf_callback_copy_move_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2227,12 +2597,12 @@ void mf_callback_copy_move_cb(void *data, Evas_Object *obj, void *event_info)
        if (ap->mf_FileRecordList.value_saver != NULL) {
                mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
                ap->mf_FileRecordList.value_saver = NULL;
+               ap->mf_FileRecordList.value_saver = mf_edit_get_all_selected_files();
        }
-       ap->mf_FileRecordList.value_saver = mf_edit_get_all_selected_files();
 
        if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) {
                ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED,
-                                                MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
+                               MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
                return;
        }
 
@@ -2281,7 +2651,7 @@ void mf_callback_details_cb(void *data, Evas_Object *obj, void *event_info)
                Eina_List *select_list = mf_edit_get_all_selected_files();
                if (mf_util_get_eina_list_len(select_list) < 1) {
                        ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED,
-                                                        MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
+                                       MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
                        return;
                }
 
@@ -2356,22 +2726,22 @@ void mf_callback_show_hidden_items_cb(void *data, Evas_Object *obj, void *event_
 }
 
 /******************************
-** Prototype    : mf_callback_paste_here_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_paste_here_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_paste_here_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2463,22 +2833,22 @@ void mf_callback_paste_here_cb(void *data, Evas_Object *obj, void *event_info)
 }
 
 /******************************
-** Prototype    : mf_move_here_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_move_here_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_move_here_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2558,22 +2928,22 @@ void mf_callback_move_here_cb(void *data, Evas_Object *obj, void *event_info)
 }
 
 /******************************
-** Prototype    : __mf_callback_confirm_delete
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : __mf_callback_confirm_delete
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *event_info)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -2593,16 +2963,18 @@ static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *eve
                /*setting item check */
                Eina_List *selected_list = mf_edit_get_all_selected_files();
 
+               mf_debug("shubham after selected list");
                if (ap->mf_FileRecordList.value_saver != NULL) {
                        mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
                        ap->mf_FileRecordList.value_saver = NULL;
                }
+               mf_debug("shubham after value saver");
                ap->mf_FileRecordList.value_saver = selected_list;
 
                if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) {
                        ap->mf_MainWindow.pNormalPopup =
-                           mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED,
-                                                 MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
+                                       mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_LABEL_NOTHING_SELECTED,
+                                                       MF_BUTTON_LABEL_OK, NULL, NULL, mf_callback_warning_popup_cb, ap);
                } else {
                        GList *pSourceList = NULL;
                        int count = 0;
@@ -2627,7 +2999,7 @@ static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *eve
                                ap->mf_FileOperation.iOperationSuccessFlag = TRUE;
                                mf_fs_monitor_remove_dir_watch();
                                ap->mf_MainWindow.pProgressPopup =
-                                   mf_popup_create_pb_popup(ap, LABEL_DELETE, MF_MSG_DELETING, count, mf_callback_progress_bar_cancel_cb, ap);
+                                               mf_popup_create_pb_popup(ap, LABEL_DELETE, MF_MSG_DELETING, count, mf_callback_progress_bar_cancel_cb, ap);
                        } else {
                                mf_util_exception_func(ap);
                        }
@@ -2643,22 +3015,22 @@ static void __mf_callback_confirm_delete(void *data, Evas_Object *obj, void *eve
 }
 
 /******************************
-** Prototype    : mf_callback_delete_cb
-** Description  :
-** Input        : void *data
-**                Evas_Object *obj
-**                void *event_info
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_delete_cb
+ ** Description  :
+ ** Input        : void *data
+ **                Evas_Object *obj
+ **                void *event_info
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_delete_cb(void *data, Evas_Object *obj, void *event_info)
 {
        struct appdata *ap = (struct appdata *)data;
@@ -2668,33 +3040,33 @@ void mf_callback_delete_cb(void *data, Evas_Object *obj, void *event_info)
        int count = mf_edit_file_count_get();
        if (count > 1) {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, LABEL_DELETE,
-                                                       MF_LABEL_ITEMS_WILL_DELETE,
-                                                       LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count);
+                               MF_LABEL_ITEMS_WILL_DELETE,
+                               LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count);
        } else {
                ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap,
-                                                       LABEL_DELETE,
-                                                       MF_LABEL_THIS_ITEM_WILL_DELETE,
-                                                       LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count);
+                               LABEL_DELETE,
+                               MF_LABEL_THIS_ITEM_WILL_DELETE,
+                               LABEL_CANCEL, LABEL_DELETE, __mf_callback_confirm_delete, ap, count);
        }
 }
 
 /******************************
-** Prototype    : mf_callback_thread_pipe_cb
-** Description  :
-** Input        : void *data
-**                void *buffer
-**                unsigned int nbyte
-** Output       : None
-** Return Value :
-** Calls        :
-** Called By    :
-**
-**  History        :
-**  1.Date         : 2010/12/10
-**    Author       : Samsung
-**    Modification : Created function
-**
-******************************/
+ ** Prototype    : mf_callback_thread_pipe_cb
+ ** Description  :
+ ** Input        : void *data
+ **                void *buffer
+ **                unsigned int nbyte
+ ** Output       : None
+ ** Return Value :
+ ** Calls        :
+ ** Called By    :
+ **
+ **  History        :
+ **  1.Date         : 2010/12/10
+ **    Author       : Samsung
+ **    Modification : Created function
+ **
+ ******************************/
 void mf_callback_operation_request_rename_cb(void *data, Evas_Object *obj, void *event_info)
 {
        MF_TRACE_BEGIN;
@@ -2798,13 +3170,13 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte)
                        ap->file_name = mf_fm_svc_get_file_name(path);
                        char *message = g_strdup_printf(label, ap->file_name);
                        ap->mf_MainWindow.pNormalPopup = mf_popup_replace_create(MF_LABEL_SAME_FOLDER, message, mf_callback_popup_cancel_cb,
-                                                        mf_callback_replace_cb, mf_callback_rename_cb, ap);
+                                       mf_callback_replace_cb, mf_callback_rename_cb, ap);
                } else {
                        char *label = gettext(MF_LABEL_SAME_FILE_LABEL);
                        ap->file_name = mf_fm_svc_get_file_name(path);
                        char *message = g_strdup_printf(label, ap->file_name);
                        ap->mf_MainWindow.pNormalPopup = mf_popup_replace_create(MF_LABEL_SAME_FILE, message, mf_callback_popup_cancel_cb,
-                                                        mf_callback_replace_cb, mf_callback_rename_cb, ap);
+                                       mf_callback_replace_cb, mf_callback_rename_cb, ap);
                }
        }
        mf_util_set_pm_lock(ap, EINA_TRUE);
@@ -2820,7 +3192,7 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte)
                        ap->mf_MainWindow.pProgressPopup = NULL;
                }
                ap->mf_MainWindow.pFinishPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
-                                                MF_LABEL_CANCELING, NULL, NULL, NULL, NULL, NULL);
+                               MF_LABEL_CANCELING, NULL, NULL, NULL, NULL, NULL);
                mf_msg_request_handled_send();
                ap->mf_FileOperation.iOperationSuccessFlag = FALSE;
                break;
@@ -2956,37 +3328,37 @@ void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte)
                        ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, MF_LABEL_UNABLE_TO_SAVE_DATA, MF_LABEL_NO_SPACE_TO_SETTING, LABEL_CANCEL, MF_LABEL_SETTINGS, NULL, mf_callback_setting_popup_cb, ap);
                }
                break;
-       case MF_MSG_END:
-               ap->mf_Status.check = 0;
-               if (ap->mf_FileOperation.source) {
-                       g_string_free(ap->mf_FileOperation.source, TRUE);
-                       ap->mf_FileOperation.source = NULL;
-               }
-               if (ap->mf_FileOperation.pSourceList) {
-                       g_list_free(ap->mf_FileOperation.pSourceList);
-                       ap->mf_FileOperation.pSourceList = NULL;
-               }
-               if (ap->mf_MainWindow.pProgressPopup) {
-                       evas_object_del(ap->mf_MainWindow.pProgressPopup);
-                       ap->mf_MainWindow.pProgressPopup = NULL;
-               }
-               mf_ecore_idler_del(ap->mf_Status.operation_refresh_idler);
-               ap->mf_Status.operation_refresh_idler = ecore_idler_add((Ecore_Task_Cb)__mf_callback_idle_refresh, ap);
-               if (pPipeMsg->pipe) {
-                       ecore_pipe_del(pPipeMsg->pipe);
-                       pPipeMsg->pipe = NULL;
-               }
-               mf_msg_request_handled_send();
+               case MF_MSG_END:
+                       ap->mf_Status.check = 0;
+                       if (ap->mf_FileOperation.source) {
+                               g_string_free(ap->mf_FileOperation.source, TRUE);
+                               ap->mf_FileOperation.source = NULL;
+                       }
+                       if (ap->mf_FileOperation.pSourceList) {
+                               g_list_free(ap->mf_FileOperation.pSourceList);
+                               ap->mf_FileOperation.pSourceList = NULL;
+                       }
+                       if (ap->mf_MainWindow.pProgressPopup) {
+                               evas_object_del(ap->mf_MainWindow.pProgressPopup);
+                               ap->mf_MainWindow.pProgressPopup = NULL;
+                       }
+                       mf_ecore_idler_del(ap->mf_Status.operation_refresh_idler);
+                       ap->mf_Status.operation_refresh_idler = ecore_idler_add((Ecore_Task_Cb)__mf_callback_idle_refresh, ap);
+                       if (pPipeMsg->pipe) {
+                               ecore_pipe_del(pPipeMsg->pipe);
+                               pPipeMsg->pipe = NULL;
+                       }
+                       mf_msg_request_handled_send();
 
-               mf_util_set_pm_lock(ap, EINA_FALSE);
-               if (ap->mf_FileRecordList.value_saver != NULL) {
-                       mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
-                       ap->mf_FileRecordList.value_saver = NULL;
-               }
-               break;
-       default:
-               mf_msg_request_handled_send();
-               break;
+                       mf_util_set_pm_lock(ap, EINA_FALSE);
+                       if (ap->mf_FileRecordList.value_saver != NULL) {
+                               mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
+                               ap->mf_FileRecordList.value_saver = NULL;
+                       }
+                       break;
+               default:
+                       mf_msg_request_handled_send();
+                       break;
        }
 
 }
@@ -3253,7 +3625,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
                        }
                        if (ap->mf_MainWindow.record.location == optStorage) {
                                ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
-                                                                    MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
+                                               MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
                        }
 
                        break;
@@ -3295,7 +3667,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
                        mf_debug("=====================  MMC  remove ==================");
 
                        ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
-                                                            MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
+                                       MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
                        /*ToDo: check whether get the error before this; */
                        if (ap->mf_FileOperation.pCancel) {
                                mf_cancel_do_cancel(ap->mf_FileOperation.pCancel);
@@ -3340,7 +3712,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
                                ap->mf_MainWindow.pProgressPopup = NULL;
                        }
                        ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
-                                                            MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
+                                       MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
                        mf_navi_bar_reset(ap);
                        mf_view_update(ap);
 
@@ -3349,7 +3721,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
                case MORE_DELETE:
                        mf_debug("=====================  MMC  remove ==================");
                        ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
-                                                            MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
+                                       MF_LABEL_MMC_REMOVED, NULL, NULL, NULL, NULL, NULL);
                        if (ap->mf_FileOperation.pCancel) {
                                mf_cancel_do_cancel(ap->mf_FileOperation.pCancel);
                        }
@@ -3377,9 +3749,9 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
 }
 
 static void __mf_callback_storage_changed_cb(int storage_id,
-        storage_dev_e dev, storage_state_e state,
-        const char *fstype, const char *fsuuid, const char *mountpath,
-        bool primary, int flags, void *user_data)
+               storage_dev_e dev, storage_state_e state,
+               const char *fstype, const char *fsuuid, const char *mountpath,
+               bool primary, int flags, void *user_data)
 {
        mf_debug("Storage Changed for memory card");
        struct appdata *ap = (struct appdata *)user_data;
@@ -3416,7 +3788,6 @@ static void __mf_callback_storage_changed_cb(int storage_id,
 int mf_callback_set_mmc_state_cb(void *data)
 {
        struct appdata *ap = (struct appdata *)data;
-       int storage_id = 0;
        int mmc_state = 0;
        mf_retvm_if(ap == NULL, -1, "appdata is NULL");
 
@@ -3562,7 +3933,7 @@ void mf_callback_genlist_imf_changed_cb(void *data, Evas_Object *obj, void *even
                }
                mf_callback_entry_unfocus(ap->mf_MainWindow.pEntry);
                ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, MF_MSG_RENAME_ILLEGAL_CHAR, MF_BUTTON_LABEL_OK, NULL,
-                                                NULL, mf_popup_show_vk_cb, ap);
+                               NULL, mf_popup_show_vk_cb, ap);
        }
        SAFE_FREE_CHAR(name);
        MF_TRACE_END;
@@ -3697,9 +4068,9 @@ void mf_callback_delete_button_cb(void *data, Evas_Object *obj, void *event_info
        SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
        ap->mf_FileOperation.idle_delete_item = params->item;
        ap->mf_MainWindow.pDeleteConfirmPopup = mf_popup_create_delete_confirm_popup(ap, MF_LABEL_DELETE_ITEM,
-                                               MF_LABEL_THIS_ITEM_WILL_DELETE,
-                                               LABEL_CANCEL, LABEL_DELETE,
-                                               __mf_callback_delete_in_idle, ap, 1);
+                       MF_LABEL_THIS_ITEM_WILL_DELETE,
+                       LABEL_CANCEL, LABEL_DELETE,
+                       __mf_callback_delete_in_idle, ap, 1);
 }
 
 void mf_callback_view_as_cb(void *data, Evas_Object *obj, void *event_info)
@@ -3770,9 +4141,9 @@ void mf_callback_more_button_cb(void *data, Evas_Object *obj, void *event_info)
                } else if (ap->mf_Status.more == MORE_SEARCH) {
                        mf_context_popup_create_more(ap, more);
                } else if (ap->mf_Status.more == MORE_INTERNAL_MOVE
-                          || ap->mf_Status.more == MORE_DATA_MOVING
-                          || ap->mf_Status.more == MORE_INTERNAL_COPY
-                          || ap->mf_Status.more == MORE_DATA_COPYING) {
+                               || ap->mf_Status.more == MORE_DATA_MOVING
+                               || ap->mf_Status.more == MORE_INTERNAL_COPY
+                               || ap->mf_Status.more == MORE_DATA_COPYING) {
                        if (ap->mf_Status.view_type != mf_view_root && ap->mf_Status.view_type != mf_view_storage) {
                                mf_context_popup_create_more(ap, more);
                        }
@@ -3784,7 +4155,7 @@ void mf_callback_more_button_cb(void *data, Evas_Object *obj, void *event_info)
 void mf_callback_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
        elm_entry_entry_set(data, "");
-//     elm_object_focus_set(data, EINA_TRUE);
+       //      elm_object_focus_set(data, EINA_TRUE);
 }
 
 void mf_callback_extension_cb(void *data, Evas_Object *obj, void *event_info)
@@ -3935,7 +4306,7 @@ bool mf_callback_create_thumbnail(void *data, media_thumbnail_completed_cb callb
 
        if (g_mf_create_thumbnail_count < MF_MAX_MAKE_THUNBNAIL_COUNT) {//Fixed P140827-07370
                ret = media_info_create_thumbnail(pListData->media, callback,
-                                                 pListData);
+                               pListData);
                if (ret != MEDIA_CONTENT_ERROR_NONE) {
                        mf_debug("Failed to create thumbnail! ret is [%d]", ret);
                        if (pListData->file_type == FILE_TYPE_IMAGE || pListData->file_type == FILE_TYPE_VIDEO) {
@@ -4241,14 +4612,14 @@ void mf_callback_item_remove_from_shortcut_cb(void *data, Evas_Object *obj, void
 
        SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup);
        ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap,
-                                                               POPMODE_TEXT_TWO_BTN,
-                                                               MF_LABEL_REMOVE_SHORTCUT,
-                                                               MF_LABEL_REMOVE_FROM_SHORTCUT,
-                                                               LABEL_CANCEL,
-                                                               MF_LABEL_REMOVE,
-                                                               NULL,
-                                                               __mf_callback_shortcut_confirm_delete,
-                                                               item_data);
+                       POPMODE_TEXT_TWO_BTN,
+                       MF_LABEL_REMOVE_SHORTCUT,
+                       MF_LABEL_REMOVE_FROM_SHORTCUT,
+                       LABEL_CANCEL,
+                       MF_LABEL_REMOVE,
+                       NULL,
+                       __mf_callback_shortcut_confirm_delete,
+                       item_data);
        MF_TRACE_END;
 }
 
@@ -4296,14 +4667,14 @@ void mf_callback_item_remove_from_recent_files_cb(void *data, Evas_Object *obj,
 
        SAFE_FREE_OBJ(ap->mf_MainWindow.pLongpressPopup);
        ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap,
-                                        POPMODE_TEXT_TWO_BTN,
-                                        MF_LABEL_REMOVE_FILE,
-                                        MF_LABEL_REMOVE_FROME_RECENT,
-                                        LABEL_CANCEL,
-                                        MF_LABEL_REMOVE,
-                                        NULL,
-                                        __mf_callback_recent_files_confirm_delete,
-                                        item_data);
+                       POPMODE_TEXT_TWO_BTN,
+                       MF_LABEL_REMOVE_FILE,
+                       MF_LABEL_REMOVE_FROME_RECENT,
+                       LABEL_CANCEL,
+                       MF_LABEL_REMOVE,
+                       NULL,
+                       __mf_callback_recent_files_confirm_delete,
+                       item_data);
 
        //elm_object_item_del(item_data->item);
 
@@ -4415,7 +4786,7 @@ void mf_callback_shortcut_rename_save_cb(void *data, Evas_Object *obj, void *eve
        } else {
                goto NORMAL_EXIT;
        }
-NORMAL_EXIT:
+       NORMAL_EXIT:
        if (ap->mf_Status.view_type == mf_view_root)
                elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_FALSE, EINA_FALSE);
        SAFE_FREE_CHAR(strstrip_name);
@@ -4423,18 +4794,18 @@ NORMAL_EXIT:
        MF_TRACE_END;
        return;
 
-INVAILD_NAME_EXIT:
+       INVAILD_NAME_EXIT:
        SAFE_FREE_CHAR(strstrip_name);
        SAFE_FREE_CHAR(pName);
        mf_callback_entry_unfocus(ap->mf_MainWindow.pEntry);
        mf_popup_second_popup_create(ap, ap->mf_MainWindow.pWindow, message,
-                                    MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap);
+                       MF_BUTTON_LABEL_OK, mf_popup_show_vk_cb, ap);
 
 
        MF_TRACE_END;
        return;
 
-ALLOC_FAILED_EXIT:
+       ALLOC_FAILED_EXIT:
        SAFE_FREE_CHAR(strstrip_name);
        SAFE_FREE_CHAR(pName);
        mf_util_operation_alloc_failed(ap);
@@ -4468,3 +4839,204 @@ void mf_callback_setting_popup_cb(void *data, Evas_Object *obj, void *event_info
                mf_callback_item_storage_usage_cb(ap, NULL, NULL);
        }
 }
+
+void mf_callback_popup_decompress_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       mf_callback_cancel_cb(ap,NULL,NULL);
+}
+
+void mf_callback_popup_compress_cancel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       mf_callback_cancel_cb(ap,NULL,NULL);
+}
+
+void mf_callback_decompress_replace_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       char *dest = g_strdup(ap->launched_file_name);
+       char olddir[1000] = {0};
+       int i = 0;
+
+       //system("rm -rf de")
+       mf_debug("start replacing dest is %s", dest);
+
+       char *temp = g_strdup(dest);
+
+       for (i = strlen(temp)-1; i>=0; i--) {
+               if (temp[i] == '.') {
+                       temp[i] = '\0';
+                       break;
+               }
+       }
+
+       snprintf(olddir,strlen(temp)+8, "rm -rf %s", temp);
+       if (temp) {
+               g_free(temp);
+       }
+       mf_debug("old dir is %s", olddir);
+       int err = system(olddir);
+       if (err == -1) {
+               mf_debug("unable to delete file");
+               return;
+       } else {
+               mf_debug("%s file deleted", temp);
+       }
+       char *ptemp = strrchr(dest, '.');
+       if (ptemp) {
+               *ptemp = '\0';
+       }
+       strncpy(ptemp, "\0\0\0\0", 4);
+       ap->dir_name = g_strdup(dest);
+       mf_file_decompression_start(ap);
+       return;
+}
+
+void mf_callback_decompress_rename_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
+       gchar *dest_string = g_strdup(ap->launched_file_name);
+
+       char *ptr = strstr(dest_string, ".zip");
+       if (ptr) {
+               strcpy(ptr,"\0");
+       }
+       GString *fullpath = g_string_new(dest_string);
+       GString *filename = NULL;
+       mf_fm_svc_wrapper_file_auto_rename(ap, fullpath, 0 , &filename);
+
+       if (filename->str)
+               mf_debug("file name is %s", filename->str);
+
+       ap->dir_name = g_strdup(filename->str);
+       mf_debug("file name is %s", ap->dir_name);
+       mf_file_decompression_start(ap);
+
+}
+
+void mf_file_compress_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+
+       Evas_Object *popup = NULL;
+
+       Eina_List *source_folder_list = NULL;
+       Eina_List *source_file_list = NULL;
+       Eina_List *l = NULL;
+       GString *it = NULL;
+
+       if (source_folder_list != NULL) {
+               mf_debug("source_folder_list is NULL");
+               mf_util_free_eina_list_with_data(&source_folder_list, MYFILE_TYPE_GSTRING);
+               source_folder_list = NULL;
+       }
+
+       if (source_file_list != NULL) {
+               mf_debug("source_file_list is NULL");
+               mf_util_free_eina_list_with_data(&source_file_list, MYFILE_TYPE_GSTRING);
+               source_file_list = NULL;
+       }
+
+       source_folder_list = mf_get_selected_folders();
+       source_file_list = mf_get_selected_files();
+
+       char *dest_name;
+
+       if(mf_util_get_eina_list_len(source_file_list) + mf_util_get_eina_list_len(source_folder_list) == 1){
+               if(mf_util_get_eina_list_len(source_file_list) == 1){
+                       l = source_file_list;
+
+               }
+               if(mf_util_get_eina_list_len(source_folder_list) == 1){
+                       l = source_folder_list;
+               }
+               it = eina_list_data_get(l);
+               dest_name = g_strdup(it->str);
+       } else{
+               if(mf_util_get_eina_list_len(source_file_list)) {
+                       it = eina_list_last_data_get(source_file_list);
+               } else {
+                       it = eina_list_last_data_get(source_folder_list);
+               }
+               ap->mf_FileOperation.source =  mf_fm_svc_wrapper_get_file_parent_path(it);
+               dest_name = g_strdup(ap->mf_FileOperation.source->str);
+       }
+
+
+       char * ext = strrchr(dest_name, '/');
+       if(ext){
+               ext++;
+       }
+
+       snprintf(str, strlen(dest_name)+strlen(ext)+7, "%s/%s.zip", dest_name, ext );
+
+       mf_debug("\destination is  %s", dest_name);
+       mf_debug("string dest is %s", str);
+
+       if (mf_file_exists(str)) {
+               char *label =  gettext(MF_LABEL_SAME_FOLDER_LABEL);
+               mf_debug("label is %s", label);
+               char *message = g_strdup_printf(label, dest_name);
+               mf_debug("message is %s", message);
+
+               popup = mf_popup_replace_create(MF_LABEL_SAME_FOLDER, message, mf_callback_popup_compress_cancel_cb,
+                               mf_callback_compress_replace_cb, mf_callback_compress_rename_cb, ap);
+               evas_object_show(popup);
+               ap->mf_MainWindow.pNormalPopup = popup;
+       } else {
+               mf_file_compression_start(ap);
+       }
+
+
+}
+
+
+void mf_callback_decompress_done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct appdata *ap = (struct appdata *)data;
+       Evas_Object *popup = NULL;
+
+       mf_debug("value of launched file name is %s", ap->launched_file_name);
+
+       char *dest = g_strdup(ap->launched_file_name);
+
+       char *ptemp = strrchr(dest, '.');
+       if (ptemp) {
+               *ptemp = '\0';
+       }
+       strncpy(ptemp, "\0\0\0\0", 4);
+
+       mf_debug("directory name is %s", dest);
+
+       DIR *dir = opendir(dest);
+
+       if (mf_file_exists(str) || dir) {
+               char *label =  gettext(MF_LABEL_SAME_FOLDER_LABEL);
+               mf_debug("label is %s", label);
+               char *message = g_strdup_printf(label, dest);
+               mf_debug("message is %s", message);
+
+
+               popup = mf_popup_replace_create(MF_LABEL_SAME_FOLDER, message, mf_callback_popup_decompress_cancel_cb,
+                               mf_callback_decompress_replace_cb, mf_callback_decompress_rename_cb, ap);
+               evas_object_show(popup);
+               ap->mf_MainWindow.pNormalPopup = popup;
+       } else if (ENOENT == errno) {
+               mf_debug("No such file or directory");
+               ap->dir_name = g_strdup(dest);
+               mf_file_decompression_start(ap);
+
+       } else {
+               mf_debug("something else happened");
+       }
+       int ret = closedir(dir);
+       if (ret) {
+               mf_debug("ubable to close directory");
+       }
+
+}
index 763a202..cae422c 100755 (executable)
@@ -243,15 +243,19 @@ int mf_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_n
        }
        assert(ap);
 
-       GString *parent_path = mf_fm_svc_wrapper_get_file_parent_path(fullpath);
+       mf_debug("enter to get name with full path as %s", fullpath->str);
+       *filename = mf_fm_svc_wrapper_get_file_parent_path(fullpath);
        GString *file_name = mf_fm_svc_wrapper_get_file_name(fullpath);
 
-       if (parent_path == NULL || file_name == NULL) {
+       mf_debug("filename is %s", (*filename)->str);
+
+       if (*filename == NULL || file_name == NULL) {
                return MYFILE_ERR_GENERATE_NAME_FAIL;
        }
-       if (parent_path->str == NULL || file_name->str == NULL) {
-               g_string_free(parent_path, TRUE);
-               parent_path = NULL;
+       if ((*filename)->str == NULL || file_name->str == NULL) {
+               mf_debug("filename->str is NULL");
+               g_string_free(*filename, TRUE);
+               *filename = NULL;
                g_string_free(file_name, TRUE);
                file_name = NULL;
                return MYFILE_ERR_GENERATE_NAME_FAIL;
@@ -260,20 +264,20 @@ int mf_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_n
        char *name = NULL;
        int error_code = 0;
 
-       if (parent_path->str != NULL) {
+       if ((*filename)->str != NULL) {
                //mf_debug("parent_full_path is [%s]", parent_path->str);
        }
 
        if (file_name->str != NULL) {
                //mf_debug("original_file_name is [%s]", file_name->str);
        }
-       error_code = __mf_fm_svc_wrapper_get_unique_name(parent_path->str, file_name->str, &name, file_name_type, ap);
+       error_code = __mf_fm_svc_wrapper_get_unique_name((*filename)->str, file_name->str, &name, file_name_type, ap);
        if (error_code) {
                SAFE_FREE_CHAR(name);
                return MYFILE_ERR_GENERATE_NAME_FAIL;
        }
-       g_string_append_printf(parent_path, "/%s", name);
-       mf_debug("After gstring append, PATH ::: [%s]", parent_path->str);
+       g_string_append_printf(*filename, "/%s", name);
+       mf_debug("After gstring append, PATH ::: [%s]", (*filename)->str);
 
        if (file_name != NULL) {
                g_string_free(file_name, TRUE);
@@ -285,7 +289,7 @@ int mf_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_n
                name = NULL;
        }
 
-       *filename = parent_path;
+//     *filename = parent_path;
        return MYFILE_ERR_NONE;
 }
 
@@ -931,6 +935,7 @@ static int __mf_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path
         int file_name_type, void *data)
 {
        //mf_debug("%s %d\n", __func__, __LINE__);
+       mf_debug("get the unique name");
        assert(unique_file_name);
        struct appdata *ap = (struct appdata *)data;
        assert(ap);
index bc7af2d..7a8bbb2 100755 (executable)
@@ -668,9 +668,7 @@ int mf_launch_service(void *data, char *path)
                Ecore_Timer *timer = NULL;
                timer = ecore_timer_add(1.0, __mf_ext_avoid_multi_click_timer_cb, data);
                g_mf_avoid_multi_tap = timer;
-
                app_control_h app_control;
-
                ret = app_control_create(&app_control);
                if (ret != APP_CONTROL_ERROR_NONE) {
                        mf_debug("app_control_create()... [0x%x]", ret);
@@ -698,7 +696,6 @@ int mf_launch_service(void *data, char *path)
                           || category == FILE_TYPE_MUSIC
                           || category == FILE_TYPE_VOICE) {
 
-                       mf_debug("category  is sound");
                        app_control_add_extra_data(app_control, "View By", "By Folder");
                        app_control_add_extra_data(app_control, "App Exit", "false");
                        int sort_type = 0;
@@ -728,10 +725,44 @@ int mf_launch_service(void *data, char *path)
                        ret = app_control_set_uri(app_control, path);
                        app_control_set_mime(app_control, "audio/*");
                } else {
-                       if (ap->mf_Status.view_type != mf_view_root_category) {
-                               app_control_add_extra_data(app_control, "launching_application", "myfile");
+                       char *file_ext = NULL;
+                       int flag = 0;
+                       int i;
+                       const char *filename = NULL;
+                       ap->launched_file_name = g_strdup(path);
+                       //ap->launched_file_name[strlen(path)] = '/0';
+                       mf_debug("ap->launched_file_name is %s", ap->launched_file_name);
+                       for (i = strlen(ap->launched_file_name)-1; i >= 0; i--) {
+                               if (ap->launched_file_name[i] == '.') {
+                                       file_ext = g_strdup(&ap->launched_file_name[i]);
+                                       flag = 1;
+                                       break;
+                               }
+                               if (ap->launched_file_name[i] == '/') {
+                                       flag = 0;
+                                       break;
+                               }
+
                        }
-                       ret = app_control_set_uri(app_control, path);
+                       if (flag) {
+                               mf_debug("file_ext[0] is %c", file_ext[0]);
+                               if (file_ext[0] == '.' && strcasecmp("ZIP", &file_ext[1]) == 0) {
+                                       mf_debug("compressed file clicked");
+                                       //      mf_view_refresh(ap);
+                                       ap->mf_Status.more = MORE_DECOMPRESS;
+                                       ap->mf_Status.view_type = mf_view_normal;
+                                       //      mf_callback_upper_click_cb(ap, NULL, NULL);
+                                               mf_view_update(ap);
+                                       return 0;
+                               }
+                       }
+                       else {
+                               if (ap->mf_Status.view_type != mf_view_root_category) {
+                                       app_control_add_extra_data(app_control, "launching_application", "myfile");
+                               }
+                               ret = app_control_set_uri(app_control, path);
+                       }
+                       //ap->launched_file_name = path;
                }
                if (ret != APP_CONTROL_ERROR_NONE) {
                        mf_debug("app_control_set_uri()... [0x%x]", ret);
index 4520b1a..8cba0e3 100755 (executable)
@@ -129,6 +129,71 @@ static int __mf_util_is_mmc_supported(int *supported)
        return MYFILE_ERR_NONE;
 }
 
+void mf_file_decompression_start(void *data)
+{
+       struct appdata *ap = (struct appdata *)data;
+       Evas_Object *popup;
+       popup = elm_popup_add(ap->mf_MainWindow.pMainLayout);
+       elm_object_signal_emit(popup, "elm,action,center_popup,entry", "");
+
+       Evas_Object *layout = mf_popup_entry_layout_create(popup);
+       elm_object_content_set(popup, layout);
+
+       Evas_Object *progressbar;
+
+       progressbar = elm_progressbar_add(layout);
+       elm_object_style_set(progressbar, "wheel");
+       evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_progressbar_pulse(progressbar, EINA_TRUE);
+       evas_object_show(progressbar);
+
+
+       pthread_t thread;
+       pthread_attr_t attr;
+       pthread_attr_init(&attr);
+       int ret;
+
+       ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+       pthread_create(&thread, &attr,(void *)& mf_callback_decompress_cb, (void *) ap);
+
+       pthread_join(thread, NULL);
+       SAFE_FREE_OBJ(progressbar);
+}
+
+void mf_file_compression_start(void *data)
+{
+       struct appdata *ap = (struct appdata *)data;
+
+       Evas_Object *popup;
+       popup = elm_popup_add(ap->mf_MainWindow.pMainLayout);
+       elm_object_signal_emit(popup, "elm,action,center_popup,entry", "");
+
+       Evas_Object *layout = mf_popup_entry_layout_create(popup);
+       elm_object_content_set(popup, layout);
+
+       Evas_Object *progressbar = NULL;
+
+       progressbar = elm_progressbar_add(layout);
+       elm_object_style_set(progressbar, "wheel");
+       evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_progressbar_pulse(progressbar, EINA_TRUE);
+       evas_object_show(progressbar);
+
+       pthread_t thread;
+       pthread_attr_t attr;
+       pthread_attr_init(&attr);
+       int ret;
+
+       ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+       pthread_create(&thread, NULL,(void *)& mf_callback_compress_cb, (void *) ap);
+       pthread_join(thread, NULL);
+//     mf_view_update(ap);
+       SAFE_FREE_OBJ(progressbar);
+       mf_callback_cancel_cb(ap,NULL,NULL);
+}
+
 /******************************
 ** Prototype    : mf_util_is_mmc_on
 ** Description  :
@@ -784,7 +849,6 @@ void mf_util_free_eina_list_with_data(Eina_List **list, MYFILE_CONTENT_TYPE type
        default:
                break;
        }
-
        eina_list_free(*list);
        do_list_pointer_protect(*list);//Now, there is the pointer which is assigned to twice. there is the wild pointer, one pointer is free, but other one still isn't NULL.
        *list = NULL;
index 49d2c66..1fc1afb 100755 (executable)
@@ -267,6 +267,10 @@ static void __mf_context_popup_item_append(Evas_Object *parent, void *data, mf_c
                item = elm_ctxpopup_item_append(ctxpopup, LABEL_DELETE, image, mf_callback_edit_delete_cb, data);
                mf_object_item_translate_set(item, LABEL_DELETE);
                break;
+       case mf_context_popup_item_compress:
+                       item = elm_ctxpopup_item_append(ctxpopup, MF_LABEL_COMPRESS, image, mf_callback_edit_compress_cb, data);
+                       mf_object_item_translate_set(item, LABEL_DELETE);
+                       break;
        case mf_context_popup_item_rename:
                item = elm_ctxpopup_item_append(ctxpopup, LABEL_RENAME, image, mf_callback_edit_rename_cb, data);
                mf_object_item_translate_set(item, LABEL_RENAME);
@@ -586,6 +590,8 @@ void mf_context_popup_create_more(void *data, Evas_Object *parent)
                                __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_new_folder);
                                //1 Rename
                                __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_rename);
+                               //1 Compress
+                               __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_compress);
                                //1 Add shortcut
                                __mf_context_popup_item_append(ctxpopup, ap, mf_context_popup_item_add_shortcut);
                                //1 Edit
diff --git a/src/widget/mf-decompress-view.c b/src/widget/mf-decompress-view.c
new file mode 100644 (file)
index 0000000..7d80f13
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * 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 "mf-object-item.h"
+#include "mf-object-conf.h"
+#include "mf-callback.h"
+#include "mf-fm-svc-wrapper.h"
+#include "mf-gengrid.h"
+#include "mf-util.h"
+#include "mf-ta.h"
+#include "mf-resource.h"
+#include "mf-launch.h"
+#include "mf-tray-item.h"
+#include "mf-navi-bar.h"
+#include "mf-edit-view.h"
+#include "mf-object.h"
+#include "mf-search-view.h"
+
+#include <unzip.h>
+
+
+
+static void __mf_genlist_checkbox_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       bool state = elm_check_state_get(obj);
+
+       struct appdata *ap = evas_object_data_get(obj, "checkbox");
+
+       if (state) {
+               ap->edit_file_list = eina_list_append(ap->edit_file_list, data);
+       } else {
+               Eina_List *temp_list = NULL;
+               void *id;
+
+               EINA_LIST_FOREACH(ap->edit_file_list, temp_list, id) {
+                       if (id == NULL) {
+                               mf_debug("invalid id");
+                               continue;
+                       }
+                       if (g_strcmp0((char*)data, (char *)id)) {
+                               id = NULL;
+                               continue;
+                       }
+               ap->edit_file_list = eina_list_remove(ap->edit_file_list, id);
+               }
+       }
+
+
+       int edit_count = eina_list_count(ap->edit_file_list);
+       //mf_navi_bar_title_content_set(ap, MF_LABEL_SELECT);
+       char *label = NULL;
+
+       if (edit_count > 0) {
+               char *tmp = mf_util_get_text(MF_LABEL_SELECTED);
+               label = g_strdup_printf(tmp, edit_count);
+       } else {
+               label = g_strdup(MF_LABEL_SELECT_ITEMS);
+       }
+       mf_object_item_text_set(ap->mf_MainWindow.pNaviItem, label, "elm.text.title");
+       SAFE_FREE_CHAR(label);
+}
+
+static void __mf_list_item_select_callback(void *data, Evas_Object *obj, void *event_info)
+{
+       elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
+       Evas_Object *ck = elm_object_item_part_content_get((Elm_Object_Item *)event_info, "elm.icon.2");
+
+       if (ck) {
+               elm_check_state_set(ck, !elm_check_state_get(ck));
+       }
+
+       __mf_genlist_checkbox_selected_cb(data, ck, event_info);
+}
+
+char * __mf_genlist_gl_decompress_label_get(void *data, Evas_Object *obj, const char *part)
+{
+       if (strcmp(part, "elm.text.main.left.top") == 0) {
+               char * d = (char *)data;
+               return strdup(d);
+       }
+       return NULL;
+}
+
+Evas_Object *__mf_genlist_gl_decompress_icon_get_lite(void *data, Evas_Object *obj, const char *part)
+{
+       if (!strcmp(part, "elm.icon.2")) {
+               Evas_Object *check = NULL;
+               check = elm_check_add(obj);
+               elm_object_style_set(check, "default");
+               elm_object_focus_set(check, EINA_FALSE);
+               evas_object_repeat_events_set(check, EINA_FALSE);
+               evas_object_propagate_events_set(check, EINA_FALSE);
+               struct appdata *ap = evas_object_data_get(obj,"naviframe");
+               evas_object_data_set(check, "checkbox", ap);
+               evas_object_smart_callback_add(check, "changed", __mf_genlist_checkbox_selected_cb, data);
+               return check;
+       }
+       return NULL;
+}
+
+static Evas_Object * __mf_decompress_view_create_content(void *data)
+{
+       struct appdata *ap = (struct appdata *)data;
+       ap->edit_file_list = NULL;
+       Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
+       (itc)->item_style = "myfile_2line.top.3";
+       (itc)->func.text_get = __mf_genlist_gl_decompress_label_get;
+       (itc)->func.content_get = __mf_genlist_gl_decompress_icon_get_lite;
+       (itc)->func.state_get = NULL;
+       (itc)->func.del = NULL;
+
+       unz_global_info gi;
+       int err,i;
+
+       Evas_Object *genlist = mf_object_create_genlist(ap->mf_MainWindow.pNaviLayout);
+
+       unz_file_info file_info;
+       unzFile uf=NULL;
+
+
+       char *source_name = g_strdup(ap->launched_file_name);
+
+       mf_debug("source name is %s and %s",source_name, ap->launched_file_name);
+
+       uf = unzOpen(source_name);
+       if (uf==NULL)
+       {
+               strcat(source_name,".zip");
+               uf = unzOpen(source_name);
+       }
+
+       if(uf == NULL) {
+               mf_debug("unable to extract files");
+       }
+
+
+
+
+       err = unzGetGlobalInfo (uf,&gi);
+       for (i=0;i<gi.number_entry;i++) {
+               char filename_inzip[256] = {0};
+               err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+               char *temp = strdup(filename_inzip);
+               evas_object_data_set(genlist, "naviframe", ap);
+               elm_genlist_item_append(genlist, itc, (void *)temp,NULL, ELM_GENLIST_ITEM_NONE, __mf_list_item_select_callback, temp);
+               temp = NULL;
+               free(temp);
+               if (i+1 < gi.number_entry) {
+                       err = unzGoToNextFile(uf);
+                       if (err!=UNZ_OK)
+                       {
+                               mf_debug("error %d with zipfile in unzGoToNextFile\n",err);
+                               break;
+                       }
+               }
+       }
+
+       return genlist;
+}
+
+void mf_decompress_view_create(void *data)
+{
+       MF_TRACE_BEGIN;
+       t_start;
+       struct appdata *ap = (struct appdata *)data;
+
+       mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL");
+       GString *title = NULL;
+       Evas_Object *newContent = NULL;
+       Evas_Object *pathinfo = NULL;
+
+       mf_navi_bar_reset_navi_obj(ap);
+
+       ap->new_file = NULL;
+
+       ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
+       char edj_path[1024] = {0};
+       char *path = app_get_resource_path();
+       snprintf(edj_path, 1024, "%s%s/%s", path, "edje", EDJ_NAME);
+       free(path);
+
+       ap->mf_MainWindow.pNaviLayout = mf_object_create_layout(ap->mf_MainWindow.pNaviBar, edj_path, "view_layout");
+
+       mf_navi_bar_layout_state_set(ap->mf_MainWindow.pNaviLayout, mf_navi_layout_normal);
+
+       ap->mf_MainWindow.pNaviBox = mf_object_create_box(ap->mf_MainWindow.pNaviLayout);
+       newContent = __mf_decompress_view_create_content(ap);
+       evas_object_show(newContent);
+
+       int location = mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str);
+       pathinfo = mf_navi_bar_create_normal_pathinfo(ap);
+       switch (location) {
+       case MYFILE_PHONE:
+               title = g_string_new(MF_UG_DETAIL_LABEL_DEVICE_MEMORY);
+               break;
+       case MYFILE_MMC:
+               title = g_string_new(MF_LABEL_SD_CARD);
+               break;
+       default:
+               title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
+               break;
+       }
+
+       if (title != NULL) {
+               title = g_string_new(LABEL_MYFILE_CHAP);
+               ap->mf_MainWindow.naviframe_title = g_strdup(title->str);
+               //elm_object_part_text_set(ap->mf_MainWindow.pNaviLayout, "Device_storage_text", ap->mf_MainWindow.naviframe_title);
+               g_string_free(title, TRUE);
+               title = NULL;
+       }
+       elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "pathinfo", pathinfo);
+       elm_box_pack_end(ap->mf_MainWindow.pNaviBox, newContent);
+       mf_navi_bar_layout_content_set(ap->mf_MainWindow.pNaviLayout, ap->mf_MainWindow.pNaviBox);
+
+       if (ap->mf_Status.pPreNaviItem) {
+               ap->mf_MainWindow.pNaviItem = elm_naviframe_item_insert_after(ap->mf_MainWindow.pNaviBar, ap->mf_Status.pPreNaviItem, "", NULL, NULL, ap->mf_MainWindow.pNaviLayout, MF_NAVI_STYLE_ENABLE);
+       } else {
+               ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviLayout, MF_NAVI_STYLE_ENABLE);
+       }
+
+
+
+       //mf_navi_add_back_button(ap, mf_callback_navi_backbutton_clicked_cb);
+       mf_naviframe_left_cancel_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_cancel_cb, ap);
+       mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_decompress_done_cb, ap);
+
+       mf_navi_bar_set_ctrlbar(data);
+       char *label = g_strdup(MF_LABEL_SELECT_ITEMS);
+       mf_object_item_text_set(ap->mf_MainWindow.pNaviItem, label, "elm.text.title");
+       SAFE_FREE_CHAR(label);
+
+       elm_naviframe_item_title_enabled_set(ap->mf_MainWindow.pNaviItem, EINA_TRUE, EINA_FALSE);
+       mf_navi_bar_title_content_set(ap, MF_LABEL_SELECT);
+
+       t_end;
+       MF_TRACE_END;
+}
index 3e48285..70be8f0 100755 (executable)
@@ -169,7 +169,6 @@ Eina_Bool mf_edit_select_all_get()
 Eina_List *mf_edit_get_all_selected_files()
 {
        MF_TRACE_BEGIN;
-
        Eina_List *select_list = NULL;
 
        Eina_List *l = NULL;
@@ -190,15 +189,67 @@ Eina_List *mf_edit_get_all_selected_files()
                        item_data = elm_object_item_data_get(it);
                        if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) {
                                GString *pTemp = g_string_new(item_data->m_ItemName->str);
+                               if (pTemp) {
+                                       select_list = eina_list_append(select_list, pTemp);
+                                       mf_error("\nFiles  : %s", pTemp->str);
+                               }
+                       }
+               }
+       }
+       MF_TRACE_END;
+       return select_list;
+
+}
+
+
+Eina_List *mf_get_selected_files()
+{
+       MF_TRACE_BEGIN;
+
+       Eina_List *select_list = NULL;
+
+       Eina_List *l = NULL;
+
+       mfItemData_s *item_data = NULL;
+       Elm_Object_Item *it = NULL;
+       EINA_LIST_FOREACH(edit_file_list, l, it) {
+               if (it) {
+                       item_data = elm_object_item_data_get(it);
+                       if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) {
+                               GString *pTemp = g_string_new(item_data->m_ItemName->str);
                                select_list = eina_list_append(select_list, pTemp);
+                               mf_error("\nFiles  : %s", pTemp->str);
                        }
                }
        }
        MF_TRACE_END;
        return select_list;
+}
+
+Eina_List *mf_get_selected_folders()
+{
+       MF_TRACE_BEGIN;
 
+       Eina_List *select_list = NULL;
+
+       Eina_List *l = NULL;
+
+       mfItemData_s *item_data = NULL;
+       Elm_Object_Item *it = NULL;
+       EINA_LIST_FOREACH(edit_folder_list, l, it) {
+               if (it) {
+                       item_data = elm_object_item_data_get(it);
+                       if (item_data && item_data->m_ItemName && item_data->m_ItemName->str) {
+                               GString *pTemp = g_string_new(item_data->m_ItemName->str);
+                               select_list = eina_list_append(select_list, pTemp);
+                       }
+               }
+       }
+       MF_TRACE_END;
+       return select_list;
 }
 
+
 void *mf_edit_file_list_item_get(int index)
 {
        Elm_Object_Item *it = NULL;
@@ -414,6 +465,8 @@ void mf_edit_gengrid_item_sel_cb(void *data, Evas_Object * obj, void *event_info
                && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT
                && ap->mf_Status.more != MORE_EDIT_UNINSTALL
                && ap->mf_Status.more != MORE_EDIT_DETAIL
+               && ap->mf_Status.more != MORE_COMPRESS
+               && ap->mf_Status.more != MORE_DECOMPRESS
           ) {
                MF_TRACE_END;
                return;
@@ -480,6 +533,8 @@ void mf_edit_list_item_sel_by_list_data(mf_list_data_t *selected, Evas_Object *
                && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT
                && ap->mf_Status.more != MORE_EDIT_UNINSTALL
                && ap->mf_Status.more != MORE_EDIT_DETAIL
+               && ap->mf_Status.more != MORE_COMPRESS
+               && ap->mf_Status.more != MORE_DECOMPRESS
           ) {
                return;
        }
@@ -769,6 +824,10 @@ void mf_edit_view_title_button_set(void *data)
                mf_naviframe_left_cancel_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_cancel_cb, ap);
                if (ap->mf_Status.more == MORE_EDIT_COPY || ap->mf_Status.more == MORE_EDIT_MOVE) {
                        mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_copy_move_cb, ap);
+               } else if (ap->mf_Status.more == MORE_COMPRESS) {
+                       mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_file_compress_cb, ap);
+               } else if (ap->mf_Status.more == MORE_DECOMPRESS) {
+                       mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_decompress_cb, ap);
                } else if (ap->mf_Status.more == MORE_EDIT_DELETE) {
                        mf_naviframe_right_save_button_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pNaviItem, mf_callback_delete_cb, ap);
                } else if (ap->mf_Status.more == MORE_SHARE_EDIT) {
index bb853c6..c5d153a 100755 (executable)
@@ -64,6 +64,8 @@ static void __mf_gengrid_icon_clicked(void *data, Evas_Object *obj, void *event_
                        || ap->mf_Status.more == MORE_EDIT_UNINSTALL
                                || ap->mf_Status.more == MORE_EDIT_DELETE_SHORTCUT
                        || ap->mf_Status.more == MORE_EDIT_DETAIL
+                       || ap->mf_Status.more == MORE_COMPRESS
+                       || ap->mf_Status.more == MORE_DECOMPRESS
                   ) {
                        return;
                }
@@ -91,6 +93,8 @@ void mf_gengrid_realized(void *data, Evas_Object *obj, void *event_info)
                || ap->mf_Status.more == MORE_EDIT_DELETE
                || ap->mf_Status.more == MORE_EDIT_UNINSTALL
                || ap->mf_Status.more == MORE_EDIT_DETAIL
+               || ap->mf_Status.more == MORE_COMPRESS
+               || ap->mf_Status.more == MORE_DECOMPRESS
           ) {
                mf_list_data_t *list_data = (mf_list_data_t *)elm_object_item_data_get(event_info);
                elm_object_item_signal_emit(event_info, "check,state,show", "");
index 628a2a8..67f2d8f 100755 (executable)
@@ -499,12 +499,14 @@ static Evas_Object *__mf_genlist_gl_default_icon_get_lite(void *data, Evas_Objec
                }
        } else if (!strcmp(part, "elm.icon.2")) {
                if (ap->mf_Status.more == MORE_SHARE_EDIT
-                       || ap->mf_Status.more == MORE_EDIT_DELETE
-                       || ap->mf_Status.more == MORE_EDIT_COPY
-                       || ap->mf_Status.more == MORE_EDIT_MOVE
-                       || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT
-                       || ap->mf_Status.more == MORE_EDIT_UNINSTALL
-                       || ap->mf_Status.more == MORE_EDIT_DETAIL) {
+                               || ap->mf_Status.more == MORE_EDIT_DELETE
+                               || ap->mf_Status.more == MORE_EDIT_COPY
+                               || ap->mf_Status.more == MORE_EDIT_MOVE
+                               || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT
+                               || ap->mf_Status.more == MORE_EDIT_UNINSTALL
+                               || ap->mf_Status.more == MORE_EDIT_DETAIL
+                               || ap->mf_Status.more == MORE_COMPRESS
+                               || ap->mf_Status.more == MORE_DECOMPRESS) {
                        if (ap->mf_Status.extra != MORE_SEARCH) {
                                Evas_Object *check = NULL;
                                check = elm_check_add(obj);
@@ -821,6 +823,7 @@ void mf_genlist_gl_selected(void *data, Evas_Object *obj, void *event_info)
                                && ap->mf_Status.more != MORE_EDIT_DELETE
                                && ap->mf_Status.more != MORE_EDIT_DELETE_SHORTCUT
                                && ap->mf_Status.more != MORE_EDIT_DELETE_RECENT
+                       && ap->mf_Status.more != MORE_COMPRESS
                ) {
                        if (selected->storage_type == MYFILE_PHONE
                                || selected->storage_type == MYFILE_MMC
@@ -1143,8 +1146,8 @@ Evas_Object *mf_genlist_create_list(void *data, Evas_Object *parent)
        case MORE_INTERNAL_COPY_MOVE:
        case MORE_DATA_COPYING:
        case MORE_DATA_MOVING:
-       case MORE_COMPRESS:
-       case MORE_DECOMPRESS:
+       //case MORE_COMPRESS:
+       //case MORE_DECOMPRESS:
        case MORE_DECOMPRESS_HERE:
        case MORE_INTERNAL_DECOMPRESS:
        case MORE_EDIT_ADD_SHORTCUT:
index eec4440..177857f 100755 (executable)
@@ -395,6 +395,8 @@ void mf_navi_bar_title_set(void *data)
                || ap->mf_Status.more == MORE_EDIT_DELETE
                        || ap->mf_Status.more == MORE_EDIT_DELETE_SHORTCUT
                || ap->mf_Status.more == MORE_EDIT_DELETE_RECENT
+               || ap->mf_Status.more == MORE_COMPRESS
+               || ap->mf_Status.more == MORE_DECOMPRESS
           ) {
                if (more == MORE_EDIT) {
                        title = MF_LABEL_SELECT_ITEMS;
@@ -928,6 +930,9 @@ Evas_Object *mf_naviframe_right_save_button_create(Evas_Object *pParent, Elm_Obj
        elm_object_style_set(btn, "naviframe/title_right");
        if (ap->mf_Status.more == MORE_EDIT_DELETE) {
                mf_object_text_set(btn, MF_LABEL_DELETE, NULL);
+       }
+       if (ap->mf_Status.more == MORE_COMPRESS) {
+                       mf_object_text_set(btn, MF_LABEL_COMPRESS, NULL);
        } else {
                mf_object_text_set(btn, MF_LABEL_DONE, NULL);
        }
index e4026d0..f9aab5c 100755 (executable)
@@ -2421,6 +2421,7 @@ void _language_changed(void *data, Evas_Object *obj, void *event_info)
 
 Evas_Object *mf_popup_replace_create(char *title, char *label_text, Evas_Smart_Cb func1, Evas_Smart_Cb func2, Evas_Smart_Cb func3, void *param)
 {
+       mf_debug("start popup");
        struct appdata *ap = mf_get_appdata();
        mf_retvm_if(ap == NULL, NULL, "ap is NULL");
        Evas_Object *popup = elm_popup_add(ap->mf_MainWindow.pWindow);
@@ -2509,6 +2510,7 @@ Evas_Object *mf_popup_replace_create(char *title, char *label_text, Evas_Smart_C
        evas_object_show(popup);
        evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __mf_popup_normal_del_cb, ap);
        eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, func1, ap);
+       mf_debug("end popup");
        return popup;
 }
 
index a316e8c..8605db3 100755 (executable)
@@ -252,9 +252,9 @@ void mf_view_refresh(void *data)
        mf_error();
        if (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE ||
                ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE ||
-               ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING ||
-               ap->mf_Status.more == MORE_INTERNAL_DECOMPRESS || ap->mf_Status.more == MORE_EDIT_ADD_SHORTCUT ||
-                       ap->mf_Status.more == MORE_EDIT_RENAME) {
+               ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING
+               || ap->mf_Status.more == MORE_EDIT_ADD_SHORTCUT ||
+                       ap->mf_Status.more == MORE_EDIT_RENAME ) {
                mf_error();
                if (ap->mf_Status.view_type == mf_view_root) {
                        mf_root_view_create(ap);
@@ -275,6 +275,10 @@ void mf_view_refresh(void *data)
                mf_callback_share_button_cb(ap, NULL, NULL);
        } else if (ap->mf_Status.more == MORE_SETTING) {
                mf_setting_view_create(ap);
+       } else if (ap->mf_Status.more == MORE_DECOMPRESS) {
+               mf_decompress_view_create(ap);
+       } else if (ap->mf_Status.more == MORE_COMPRESS) {
+               mf_normal_view_create(ap);
        }
        mf_error();
        ap->mf_Status.flagViewAsRefreshView = EINA_FALSE;
index ce3c491..eece25a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.myfile" version="1.0.0">
     <profile name="mobile"/>
-    <ui-application appid="org.tizen.myfile" exec="myfile" hw-acceleration="on" process-pool="true" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+    <ui-application appid="org.tizen.myfile" exec="myfile" hw-acceleration="on" multiple="false" nodisplay="false" process-pool="true" taskmanage="true" type="capp">
         <label>My Files</label>
         <label xml:lang="bn-in">আমার ফাইল</label>
         <label xml:lang="gu-in">મારી ફાઇલ્સ</label>
         <label xml:lang="fr-ca">Mes fichiers</label>
         <label xml:lang="es-mx">Mis Archivos</label>
         <icon>org.tizen.myfile.png</icon>
+        <background-category value="media"/>
     </ui-application>
     <privileges>
-        <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
-        <privilege>http://tizen.org/privilege/datasharing</privilege>
         <privilege>http://tizen.org/privilege/mediastorage</privilege>
-        <privilege>http://tizen.org/privilege/content.write</privilege>
         <privilege>http://tizen.org/privilege/appmanager.launch</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>