diff options
author | Chandan <ch.kumar@samsung.com> | 2017-01-24 14:37:06 +0530 |
---|---|---|
committer | Chandan <ch.kumar@samsung.com> | 2017-01-24 14:37:06 +0530 |
commit | d55e46ff3b94c9f5693fee812775d3f71b616994 (patch) | |
tree | 784d79f190c418cc34485000f8d363d98f44bdcf /src | |
parent | 29a4450c7957dbff62d34c7fe09781c5b4d8b319 (diff) | |
download | attach-panel-document-d55e46ff3b94c9f5693fee812775d3f71b616994.tar.gz attach-panel-document-d55e46ff3b94c9f5693fee812775d3f71b616994.tar.bz2 attach-panel-document-d55e46ff3b94c9f5693fee812775d3f71b616994.zip |
Aligned Supported FileTypes with MyFiles
Change-Id: Idf68d3eb40d9edf9a1d15b4dafae5a7a019192f3
Signed-off-by: Chandan <ch.kumar@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/doc-data.c | 447 | ||||
-rw-r--r-- | src/doc-list.c | 424 |
2 files changed, 448 insertions, 423 deletions
diff --git a/src/doc-data.c b/src/doc-data.c index 5a5d6e8..13c254d 100644 --- a/src/doc-data.c +++ b/src/doc-data.c @@ -105,6 +105,428 @@ int doc_data_get_sel_paths(doc_ugdata * ugd, char **filepath, return 0; } +static fsFileType _document_attr_get_category_by_file_ext(const char + *file_ext) +{ + int i = 0; + + if (file_ext == NULL) { + return FILE_TYPE_ETC; + } + + if (file_ext[0] == '.') { + i = 1; + } + + switch (file_ext[i]) { + case 'a': + case 'A': + if (strcasecmp("ASF", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("AMR", &file_ext[i]) == 0) { + return FILE_TYPE_VOICE; + } + if (strcasecmp("AWB", &file_ext[i]) == 0) { + return FILE_TYPE_VOICE; + } + if (strcasecmp("AAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("AVI", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("AAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + + break; + case 'b': + case 'B': + if (strcasecmp("BMP", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'c': + case 'C': + if (strcasecmp("csv", &file_ext[i]) == 0) { + return FILE_TYPE_CSV; + } + break; + case 'd': + case 'D': + if (strcasecmp("DOC", &file_ext[i]) == 0) { + return FILE_TYPE_DOC; + } + if (strcasecmp("DOCX", &file_ext[i]) == 0) { + return FILE_TYPE_DOC; + } + if (strcasecmp("DIVX", &file_ext[i]) == 0) { + { + return FILE_TYPE_VIDEO; + } + } + break; + case 'E': + case 'e': + if (strcasecmp("EML", &file_ext[i]) == 0) { + return FILE_TYPE_EML; + } + break; + case 'f': + case 'F': + if (strcasecmp("FLAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'g': + case 'G': + if (strcasecmp("GIF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("G72", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("GUL", &file_ext[i]) == 0) { + return FILE_TYPE_GUL; + } + break; + case 'h': + case 'H': + if (strcasecmp("HTML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("HTM", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("HWP", &file_ext[i]) == 0) { + return FILE_TYPE_HWP; + } + break; + case 'i': + case 'I': + if (strcasecmp("IMY", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("IPK", &file_ext[i]) == 0) { + return FILE_TYPE_APP; + } + if (strcasecmp("ICS", &file_ext[i]) == 0) { + return FILE_TYPE_VCALENDAR; + } + break; + case 'j': + case 'J': + if (strcasecmp("JAD", &file_ext[i]) == 0) { + return FILE_TYPE_JAVA; + } + if (strcasecmp("JAR", &file_ext[i]) == 0) { + return FILE_TYPE_JAVA; + } + + if (strcasecmp("JPG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JPEG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JPE", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JP2", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'm': + case 'M': + if (strcasecmp("MMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MP3", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("MID", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MIDI", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MP4", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MPG", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MPEG", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("M4A", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("M3G", &file_ext[i]) == 0) { + return FILE_TYPE_FLASH; + } + if (strcasecmp("MXMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MKV", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MKA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'o': + case 'O': + if (strcasecmp("opml", &file_ext[i]) == 0) { + return FILE_TYPE_RSS; + } + if (strcasecmp("ogg", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'p': + case 'P': + if (strcasecmp("PNG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("PJPEG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("PDF", &file_ext[i]) == 0) { + return FILE_TYPE_PDF; + } + if (strcasecmp("PPT", &file_ext[i]) == 0) { + return FILE_TYPE_PPT; + } + if (strcasecmp("PPTX", &file_ext[i]) == 0) { + return FILE_TYPE_PPT; + } + if (strcasecmp("PEM", &file_ext[i]) == 0) { + return FILE_TYPE_CERTIFICATION; + } + break; + case 'r': + case 'R': + if (strcasecmp("RA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("RTF", &file_ext[i]) == 0) { + return FILE_TYPE_DOC; + } + break; + case 's': + case 'S': + if (strcasecmp("SDP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("SPM", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SMP", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SPF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SWF", &file_ext[i]) == 0) { + return FILE_TYPE_FLASH; + } + if (strcasecmp("SCN", &file_ext[i]) == 0) { + return FILE_TYPE_MOVIE_MAKER; + } + if (strcasecmp("SVG", &file_ext[i]) == 0) { + return FILE_TYPE_SVG; + } + if (strcasecmp("SVGZ", &file_ext[i]) == 0) { + return FILE_TYPE_SVG; + } + if (strcasecmp("SNB", &file_ext[i]) == 0) { + return FILE_TYPE_SNB; + } + if (strcasecmp("SPD", &file_ext[i]) == 0) { + return FILE_TYPE_SPD; + } + + break; + case 't': + case 'T': + if (strcasecmp("TXT", &file_ext[i]) == 0) { + return FILE_TYPE_TXT; + } + if (strcasecmp("THM", &file_ext[i]) == 0) { + return FILE_TYPE_THEME; + } + if (strcasecmp("TPK", &file_ext[i]) == 0) { + return FILE_TYPE_TPK; + } + if (strcasecmp("TIF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'v': + case 'V': + if (strcasecmp("VCF", &file_ext[i]) == 0) { + return FILE_TYPE_VCONTACT; + } + if (strcasecmp("VCS", &file_ext[i]) == 0) { + return FILE_TYPE_VCALENDAR; + } + if (strcasecmp("VNT", &file_ext[i]) == 0) { + return FILE_TYPE_VNOTE; + } + if (strcasecmp("VBM", &file_ext[i]) == 0) { + return FILE_TYPE_VBOOKMARK; + } + if (strcasecmp("VTS", &file_ext[i]) == 0) { + return FILE_TYPE_TASK; + } + break; + case 'w': + case 'W': + if (strcasecmp("WAV", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("WBMP", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("WGT", &file_ext[i]) == 0) { + return FILE_TYPE_WGT; + } + if (strcasecmp("WMA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("WMV", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("WML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("WAVE", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("WMF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'x': + case 'X': + if (strcasecmp("XLS", &file_ext[i]) == 0) { + return FILE_TYPE_EXCEL; + } + if (strcasecmp("XLSX", &file_ext[i]) == 0) { + return FILE_TYPE_EXCEL; + } + if (strcasecmp("XMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("XHTML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("XML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + break; + case 'z': + case 'Z': + if (strcasecmp("ZIP", &file_ext[i]) == 0) { + return FILE_TYPE_ZIP; + } + break; + case '3': + if (strcasecmp("3GP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("3GPP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("3G2", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + break; + } + + return FILE_TYPE_ETC; +} + +static Eina_Bool _doc_list_is_dir(const char *path) +{ + if (!path) { + return 0; + } + + struct stat info = { 0, }; + + if (stat(path, &info) == 0) { + if (S_ISDIR(info.st_mode)) { + return 1; + } + } + + return 0; +} + +static Eina_Bool _document_attr_is_dir(const char *filepath) +{ + DOC_CHECK_FALSE(filepath); + + return _doc_list_is_dir(filepath); +} + +const char *_document_file_get(const char path[]) +{ + char *file = NULL; + if ((file = strrchr(path, '/'))) { + file++; + } else { + file = (char *) path; + } + + return file; +} + +int document_file_category(const char *filepath, fsFileType * category) +{ + int i = 0; + int flag = 0; + + if (_document_attr_is_dir(filepath)) { + *category = FILE_TYPE_DIR; + return 0; + } + + const char *filename = NULL; + filename = _document_file_get(filepath); + if (filename == NULL) { + *category = FILE_TYPE_NONE; + return -1; + } + char *file_ext = NULL; + /*ToDo: error file name like the last letter is "." */ + for (i = strlen(filename); i >= 0; i--) { + if (filename[i] == '.') { + file_ext = g_strdup(&filename[i + 1]); + flag = 1; + break; + } + + if (filename[i] == '/') { + flag = 0; + break; + } + } + + if (flag == 1) { + *category = _document_attr_get_category_by_file_ext(file_ext); + SAFE_FREE_CHAR(file_ext); + return 0; + } else { + *category = FILE_TYPE_NONE; + SAFE_FREE_CHAR(file_ext); + return -1; + } +} + int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos, int end_pos, Eina_List ** pmedias_elist, doc_restore_selected_cb restore_cb, @@ -139,6 +561,31 @@ int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos, doc_dbgE("Invalid item!"); continue; } + doc_dbgE("Chandan:: Item is %s", item->display_name); + fsFileType type = FILE_TYPE_NONE; + doc_dbgE("1111111"); + document_file_category(item->display_name, &type); + doc_dbgE("Chandan:: Type is %d", type); + + bool isUnsupported = false; + + switch(type) { + case FILE_TYPE_DOC: + case FILE_TYPE_PDF: + case FILE_TYPE_PPT: + case FILE_TYPE_EXCEL: + case FILE_TYPE_TXT: + case FILE_TYPE_HWP: + case FILE_TYPE_SPD: + case FILE_TYPE_SNB: + break; + default: + doc_dbgE("File Type not supported"); + isUnsupported = true; + break; + } + + if (isUnsupported == true) continue; ditem = doc_data_util_calloc_item(); if (ditem == NULL) { diff --git a/src/doc-list.c b/src/doc-list.c index 8bd31cd..a21bb4d 100644 --- a/src/doc-list.c +++ b/src/doc-list.c @@ -343,428 +343,6 @@ static Evas_Object *_doc_nocontent_create(void *data) return layout; } -static Eina_Bool _doc_list_is_dir(const char *path) -{ - if (!path) { - return 0; - } - - struct stat info = { 0, }; - - if (stat(path, &info) == 0) { - if (S_ISDIR(info.st_mode)) { - return 1; - } - } - - return 0; -} - -static Eina_Bool _document_attr_is_dir(const char *filepath) -{ - DOC_CHECK_FALSE(filepath); - - return _doc_list_is_dir(filepath); -} - -const char *_document_file_get(const char path[]) -{ - char *file = NULL; - if ((file = strrchr(path, '/'))) { - file++; - } else { - file = (char *) path; - } - - return file; -} - -static fsFileType _document_attr_get_category_by_file_ext(const char - *file_ext) -{ - int i = 0; - - if (file_ext == NULL) { - return FILE_TYPE_ETC; - } - - if (file_ext[0] == '.') { - i = 1; - } - - switch (file_ext[i]) { - case 'a': - case 'A': - if (strcasecmp("ASF", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("AMR", &file_ext[i]) == 0) { - return FILE_TYPE_VOICE; - } - if (strcasecmp("AWB", &file_ext[i]) == 0) { - return FILE_TYPE_VOICE; - } - if (strcasecmp("AAC", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("AVI", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("AAC", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - - break; - case 'b': - case 'B': - if (strcasecmp("BMP", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - break; - case 'c': - case 'C': - if (strcasecmp("csv", &file_ext[i]) == 0) { - return FILE_TYPE_CSV; - } - break; - case 'd': - case 'D': - if (strcasecmp("DOC", &file_ext[i]) == 0) { - return FILE_TYPE_DOC; - } - if (strcasecmp("DOCX", &file_ext[i]) == 0) { - return FILE_TYPE_DOC; - } - if (strcasecmp("DIVX", &file_ext[i]) == 0) { - { - return FILE_TYPE_VIDEO; - } - } - break; - case 'E': - case 'e': - if (strcasecmp("EML", &file_ext[i]) == 0) { - return FILE_TYPE_EML; - } - break; - case 'f': - case 'F': - if (strcasecmp("FLAC", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - break; - case 'g': - case 'G': - if (strcasecmp("GIF", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("G72", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("GUL", &file_ext[i]) == 0) { - return FILE_TYPE_GUL; - } - break; - case 'h': - case 'H': - if (strcasecmp("HTML", &file_ext[i]) == 0) { - return FILE_TYPE_HTML; - } - if (strcasecmp("HTM", &file_ext[i]) == 0) { - return FILE_TYPE_HTML; - } - if (strcasecmp("HWP", &file_ext[i]) == 0) { - return FILE_TYPE_HWP; - } - break; - case 'i': - case 'I': - if (strcasecmp("IMY", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("IPK", &file_ext[i]) == 0) { - return FILE_TYPE_APP; - } - if (strcasecmp("ICS", &file_ext[i]) == 0) { - return FILE_TYPE_VCALENDAR; - } - break; - case 'j': - case 'J': - if (strcasecmp("JAD", &file_ext[i]) == 0) { - return FILE_TYPE_JAVA; - } - if (strcasecmp("JAR", &file_ext[i]) == 0) { - return FILE_TYPE_JAVA; - } - - if (strcasecmp("JPG", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("JPEG", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("JPE", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("JP2", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - break; - case 'm': - case 'M': - if (strcasecmp("MMF", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("MP3", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("MID", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("MIDI", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("MP4", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("MPG", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("MPEG", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("M4A", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("M3G", &file_ext[i]) == 0) { - return FILE_TYPE_FLASH; - } - if (strcasecmp("MXMF", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("MKV", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("MKA", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - break; - case 'o': - case 'O': - if (strcasecmp("opml", &file_ext[i]) == 0) { - return FILE_TYPE_RSS; - } - if (strcasecmp("ogg", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - break; - case 'p': - case 'P': - if (strcasecmp("PNG", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("PJPEG", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("PDF", &file_ext[i]) == 0) { - return FILE_TYPE_PDF; - } - if (strcasecmp("PPT", &file_ext[i]) == 0) { - return FILE_TYPE_PPT; - } - if (strcasecmp("PPTX", &file_ext[i]) == 0) { - return FILE_TYPE_PPT; - } - if (strcasecmp("PEM", &file_ext[i]) == 0) { - return FILE_TYPE_CERTIFICATION; - } - break; - case 'r': - case 'R': - if (strcasecmp("RA", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("RTF", &file_ext[i]) == 0) { - return FILE_TYPE_DOC; - } - break; - case 's': - case 'S': - if (strcasecmp("SDP", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("SPM", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("SMP", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("SPF", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("SWF", &file_ext[i]) == 0) { - return FILE_TYPE_FLASH; - } - if (strcasecmp("SCN", &file_ext[i]) == 0) { - return FILE_TYPE_MOVIE_MAKER; - } - if (strcasecmp("SVG", &file_ext[i]) == 0) { - return FILE_TYPE_SVG; - } - if (strcasecmp("SVGZ", &file_ext[i]) == 0) { - return FILE_TYPE_SVG; - } - if (strcasecmp("SNB", &file_ext[i]) == 0) { - return FILE_TYPE_SNB; - } - if (strcasecmp("SPD", &file_ext[i]) == 0) { - return FILE_TYPE_SPD; - } - - break; - case 't': - case 'T': - if (strcasecmp("TXT", &file_ext[i]) == 0) { - return FILE_TYPE_TXT; - } - if (strcasecmp("THM", &file_ext[i]) == 0) { - return FILE_TYPE_THEME; - } - if (strcasecmp("TPK", &file_ext[i]) == 0) { - return FILE_TYPE_TPK; - } - if (strcasecmp("TIF", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - break; - case 'v': - case 'V': - if (strcasecmp("VCF", &file_ext[i]) == 0) { - return FILE_TYPE_VCONTACT; - } - if (strcasecmp("VCS", &file_ext[i]) == 0) { - return FILE_TYPE_VCALENDAR; - } - if (strcasecmp("VNT", &file_ext[i]) == 0) { - return FILE_TYPE_VNOTE; - } - if (strcasecmp("VBM", &file_ext[i]) == 0) { - return FILE_TYPE_VBOOKMARK; - } - if (strcasecmp("VTS", &file_ext[i]) == 0) { - return FILE_TYPE_TASK; - } - break; - case 'w': - case 'W': - if (strcasecmp("WAV", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("WBMP", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - if (strcasecmp("WGT", &file_ext[i]) == 0) { - return FILE_TYPE_WGT; - } - if (strcasecmp("WMA", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("WMV", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("WML", &file_ext[i]) == 0) { - return FILE_TYPE_HTML; - } - if (strcasecmp("WAVE", &file_ext[i]) == 0) { - return FILE_TYPE_MUSIC; - } - if (strcasecmp("WMF", &file_ext[i]) == 0) { - return FILE_TYPE_IMAGE; - } - break; - case 'x': - case 'X': - if (strcasecmp("XLS", &file_ext[i]) == 0) { - return FILE_TYPE_EXCEL; - } - if (strcasecmp("XLSX", &file_ext[i]) == 0) { - return FILE_TYPE_EXCEL; - } - if (strcasecmp("XMF", &file_ext[i]) == 0) { - return FILE_TYPE_SOUND; - } - if (strcasecmp("XHTML", &file_ext[i]) == 0) { - return FILE_TYPE_HTML; - } - if (strcasecmp("XML", &file_ext[i]) == 0) { - return FILE_TYPE_HTML; - } - break; - case 'z': - case 'Z': - if (strcasecmp("ZIP", &file_ext[i]) == 0) { - return FILE_TYPE_ZIP; - } - break; - case '3': - if (strcasecmp("3GP", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("3GPP", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - if (strcasecmp("3G2", &file_ext[i]) == 0) { - return FILE_TYPE_VIDEO; - } - break; - } - - return FILE_TYPE_ETC; -} - -int _document_file_category(const char *filepath, fsFileType * category) -{ - int i = 0; - int flag = 0; - - if (_document_attr_is_dir(filepath)) { - *category = FILE_TYPE_DIR; - return 0; - } - - const char *filename = NULL; - filename = _document_file_get(filepath); - if (filename == NULL) { - *category = FILE_TYPE_NONE; - return -1; - } - char *file_ext = NULL; - /*ToDo: error file name like the last letter is "." */ - for (i = strlen(filename); i >= 0; i--) { - if (filename[i] == '.') { - file_ext = g_strdup(&filename[i + 1]); - flag = 1; - break; - } - - if (filename[i] == '/') { - flag = 0; - break; - } - } - - if (flag == 1) { - *category = _document_attr_get_category_by_file_ext(file_ext); - SAFE_FREE_CHAR(file_ext); - return 0; - } else { - *category = FILE_TYPE_NONE; - SAFE_FREE_CHAR(file_ext); - return -1; - } -} - const char *_document_file_attr_get_default_icon_by_type(fsFileType ftype) { const char *icon_path = DOC_DEFAULT_ICON; @@ -798,7 +376,7 @@ static Evas_Object *_doc_list_item_content_get(void *data, if (!g_strcmp0(part, "elm.swallow.icon")) { fsFileType type = FILE_TYPE_NONE; - _document_file_category(item->item->file_url, &type); + document_file_category(item->item->file_url, &type); const char *thumb = _document_file_attr_get_default_icon_by_type(type); |