2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <dbus/dbus.h>
28 #include <vconf-keys.h>
32 #include "mf-callback.h"
33 #include "mf-fm-svc-wrapper.h"
35 #include "mf-widget.h"
36 #include "mf-fs-util.h"
37 #include "mf-launch.h"
39 #include "mf-inotify-handle.h"
41 #include "mf-delete.h"
44 #include "mf-resource.h"
45 #include "mf-language-mgr.h"
46 #include "mf-s-beam.h"
50 struct appdata *temp_data;
51 pthread_mutex_t pb_mutex = PTHREAD_MUTEX_INITIALIZER;
52 /* mutex for refresh */
53 pthread_mutex_t refresh_mutex = PTHREAD_MUTEX_INITIALIZER;
54 /* mutex for dbus message */
55 pthread_mutex_t refresh_lock;
56 pthread_cond_t refresh_finished;
57 unsigned int refresh_flag = 0;
58 typedef struct _mf_dir_event_t {
63 void mf_callback_save_cb(void *data, Evas_Object * obj, void *event_info);
64 void mf_callback_cancel_cb(void *data, Evas_Object * obj, void *event_info);
65 static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage);
67 /******************************
68 ** Prototype : mf_callback_warning_popup_cb
79 ** 1.Date : 2010/12/10
81 ** Modification : Created function
83 ******************************/
84 void mf_callback_warning_popup_cb(void *data, Evas_Object * obj, void *event_info)
86 struct appdata *ap = (struct appdata *)data;
89 Evas_Object *btn = (Evas_Object *)obj;
90 const char *label = elm_object_text_get(btn);
92 if (g_strcmp0(label, GET_SYS_STR(MF_BUTTON_LABEL_OK)) == 0 ) {
93 evas_object_del(ap->mf_MainWindow.pNormalPopup);
94 ap->mf_MainWindow.pNormalPopup = NULL;
98 /******************************
99 ** Prototype : mf_callback_app_rotate_cb
101 ** Input : enum appcore_rm mode
109 ** 1.Date : 2010/12/10
111 ** Modification : Created function
113 ******************************/
114 #ifdef MYFILE_SPLIT_VIEW
116 static Eina_Bool __mf_callback_do_rotation_cb (void *data)
119 struct appdata *ap = data;
122 mf_widget_create(ap);
123 mf_widget_set_main_layout_content(ap);
125 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
126 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
127 mf_split_view_refresh(ap);
130 if (!(ap->mf_Status.more == MORE_EDIT ||
131 ap->mf_Status.more == MORE_CREATE_FOLDER ||
132 ap->mf_Status.more == MORE_THUMBNAIL_RENAME ||
133 (ap->mf_Status.more == MORE_RENAME && ap->mf_Status.preMore == MORE_EDIT) ||
134 ap->mf_Status.more == MORE_SEARCH || (ap->mf_Status.more == MORE_RENAME && ap->mf_Status.preMore == MORE_SEARCH))) {
135 if (ap->mf_Status.more == MORE_DEFAULT) {
136 mf_navi_bar_create_default_view(ap);
137 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
138 } else if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
139 || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) {
140 mf_navi_bar_create_path_select_view(ap);
141 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
144 if (ap->mf_Status.more == MORE_EDIT) {
145 mf_navi_bar_title_set(ap);
150 if (ap->mf_Status.more == MORE_RENAME || ap->mf_Status.more == MORE_SEARCH || ap->mf_Status.more == MORE_CREATE_FOLDER || (ap->mf_Status.more == MORE_RENAME && ap->mf_Status.preMore == MORE_SEARCH)) {
151 if (ap->mf_MainWindow.pEntry) {
152 if (ap->mf_Status.flagIME != EINA_FALSE) {
153 if (ap->mf_MainWindow.pNormalPopup == NULL) {
154 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_TRUE);
159 if (ap->mf_Status.more == MORE_SEARCH) {
160 if (ap->mf_MainWindow.pSearchEntry) {
161 if (ap->mf_Status.flagIME != EINA_FALSE) {
162 if (ap->mf_MainWindow.pNormalPopup == NULL) {
163 elm_object_focus_set(ap->mf_MainWindow.pSearchEntry, EINA_TRUE);
169 mf_genlist_gl_edit_item_selected(ap);/*note: for plm issue:P121002-2027*/
170 mf_navi_bar_title_set(ap);
173 return ECORE_CALLBACK_CANCEL;
176 void mf_callback_app_rotate_cb(app_device_orientation_e mode, void *data)
179 struct appdata *ap = data;
182 if (ap->mf_Status.pre_rotate_type == mode)
185 const char *config = elm_config_profile_get();
186 if (!strcmp(config, "desktop"))
189 enum ug_event evt = UG_EVENT_NONE;
192 case APP_DEVICE_ORIENTATION_270:
193 ap->mf_Status.rotation_angle = -90;
194 ap->mf_Status.view_mode_end = FALSE;
195 ap->mf_Status.pre_rotate_type = APP_DEVICE_ORIENTATION_270;
196 evt = UG_EVENT_ROTATE_LANDSCAPE;
199 case APP_DEVICE_ORIENTATION_90:
200 ap->mf_Status.rotation_angle = 90;
201 ap->mf_Status.view_mode_end = FALSE;
202 ap->mf_Status.pre_rotate_type = APP_DEVICE_ORIENTATION_90;
203 evt = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
206 case APP_DEVICE_ORIENTATION_180:
207 ap->mf_Status.rotation_angle = 180;
208 ap->mf_Status.view_mode_end = TRUE;
209 ap->mf_Status.pre_rotate_type = APP_DEVICE_ORIENTATION_180;
210 evt = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
213 case APP_DEVICE_ORIENTATION_0 :
215 ap->mf_Status.rotation_angle = 0;
216 ap->mf_Status.view_mode_end = TRUE;
217 ap->mf_Status.pre_rotate_type = APP_DEVICE_ORIENTATION_0;
218 evt = UG_EVENT_ROTATE_PORTRAIT;
224 if (ap->mf_MainWindow.pContextPopup) {
225 evas_object_del(ap->mf_MainWindow.pContextPopup);
226 ap->mf_MainWindow.pContextPopup = NULL;
227 ap->mf_Status.flagCtxPopShow = EINA_TRUE;
229 ap->mf_Status.flagCtxPopShow = EINA_FALSE;
232 if (mode == APP_DEVICE_ORIENTATION_270 || mode == APP_DEVICE_ORIENTATION_90) {
233 ap->mf_Status.rotation_type = MF_ROTATE_LANDSCAPE;
235 ap->mf_Status.rotation_type = MF_ROTATE_PORTRAIT;
237 elm_win_rotation_with_resize_set(ap->mf_MainWindow.pWindow, ap->mf_Status.rotation_angle);
238 __mf_callback_do_rotation_cb(ap);
245 void mf_callback_app_rotate_cb(app_device_orientation_e mode, void *data)
247 struct appdata *ap = data;
250 ap->mf_Status.rotation_type = mode;
252 if (ap->mf_FileOperation.ugImageViewer) {
253 enum ug_mode md = ug_get_mode(ap->mf_FileOperation.ugImageViewer);
254 enum ug_event ev = UG_EVENT_ROTATE_LANDSCAPE;
255 if (md == UG_MODE_FULLVIEW) {
257 case APP_DEVICE_ORIENTATION_0 :
258 elm_win_rotation_with_resize_set(ap->mf_MainWindow.pWindow, 0);
259 ev = UG_EVENT_ROTATE_PORTRAIT;
261 case APP_DEVICE_ORIENTATION_180:
262 elm_win_rotation_with_resize_set(ap->mf_MainWindow.pWindow, 180);
263 ev = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
265 case APP_DEVICE_ORIENTATION_270:
266 elm_win_rotation_with_resize_set(ap->mf_MainWindow.pWindow, 270);
267 ev = UG_EVENT_ROTATE_LANDSCAPE;
269 case APP_DEVICE_ORIENTATION_90:
270 elm_win_rotation_with_resize_set(ap->mf_MainWindow.pWindow, 90);
271 ev = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
276 /*send event to ug */
283 #ifdef MYFILE_SPLIT_VIEW
284 void mf_callback_storage_cb(void *data, const char *label)
287 mf_retm_if(data == NULL, "data is NULL");
288 mf_retm_if(label == NULL, "label is NULL");
290 struct appdata *ap = (struct appdata *)data;
291 mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL");
292 mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL");
293 Evas_Object *pNaviBar = NULL;
294 myfileNaviBar *pNavi_s_inuse = NULL;
295 myfileNaviBar *pNavi_s_toshow = NULL;
296 myfileNaviBar *pNaviBarStruct = NULL;
297 char *rootpath = NULL;
298 int current_storage = MYFILE_PHONE;
299 int current_more = ap->mf_Status.more;
300 pNavi_s_inuse = mf_navi_bar_get_in_use(ap);
302 current_storage = mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str);
304 if (g_strcmp0(pNavi_s_inuse->pNaviLabel, label) == 0) {
308 if (ap->mf_Status.more == MORE_SEARCH) {
309 ap->mf_Status.more = MORE_DEFAULT;
311 pNavi_s_inuse->naviFlagInUse = FALSE;
312 pNaviBarStruct = mf_navi_bar_get_navi_from_navilist(ap->mf_MainWindow.plistNaviBar, label);
315 if (pNaviBarStruct == NULL) {
316 /*2.0 get root path by storage label */
317 rootpath = mf_fm_svc_wrapper_get_root_path_by_tab_label(label);
318 CHAR_CHECK_NULL_GOTO(rootpath, ERROR_EXIT);
320 /*2.1 create the navi for the tab */
321 pNavi_s_toshow = malloc(sizeof(myfileNaviBar));
322 CHAR_CHECK_NULL_GOTO(pNavi_s_toshow, ERROR_EXIT);
323 memset(pNavi_s_toshow, 0, sizeof(myfileNaviBar));
325 pNavi_s_toshow->naviFlagInUse = TRUE;
326 /*2.2 set path as root path of the storage */
327 pNavi_s_toshow->pCurrentPath = g_strdup(rootpath);
328 pNavi_s_toshow->pNaviLabel = strdup(label);
330 /*2.3 insert phone navi into the navi_list */
331 ap->mf_MainWindow.plistNaviBar = eina_list_append(ap->mf_MainWindow.plistNaviBar, pNavi_s_toshow);
333 g_string_free(ap->mf_Status.path, TRUE);
334 ap->mf_Status.path = NULL;
335 ap->mf_Status.path = g_string_new(pNavi_s_toshow->pCurrentPath);
336 if (ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
337 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE) {
338 SAFE_FREE_GSTRING(pNavi_s_toshow->pre_operation.path);
339 pNavi_s_toshow->pre_operation.path = g_string_new(pNavi_s_toshow->pCurrentPath);
340 pNavi_s_toshow->naviFlagEditJoin = TRUE;
342 if (ap->mf_Status.more == MORE_DEFAULT) {
343 mf_navi_bar_create_default_view(ap);
344 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
345 } else if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
346 || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) {
347 mf_navi_bar_create_path_select_view(ap);
348 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
351 ap->mf_Status.more = current_more;
354 /*2.1 get the navi of the tab */
355 pNaviBar = ap->mf_MainWindow.pNaviBar;
356 pNavi_s_toshow = mf_navi_bar_get_struct_by_label(ap, label);
357 pNavi_s_toshow->naviFlagInUse = TRUE;
359 /*2.2 set related status value. */
360 g_string_free(ap->mf_Status.path, TRUE);
361 ap->mf_Status.path = NULL;
363 ap->mf_Status.path = g_string_new(pNavi_s_toshow->pCurrentPath);
364 /*2.3 update the content to catch update */
365 /*Todo: How to ensure insert only once */
366 if (ap->mf_Status.more == MORE_DEFAULT) {
367 mf_navi_bar_create_default_view(ap);
368 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
369 } else if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
370 || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) {
371 mf_navi_bar_create_path_select_view(ap);
372 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
380 SAFE_FREE_CHAR(pNavi_s_toshow);
381 SAFE_FREE_CHAR(rootpath);
392 /******************************
393 ** Prototype : tab_callback
395 ** Input : void *data
404 ** 1.Date : 2010/12/10
406 ** Modification : Created function
408 ******************************/
409 void mf_callback_tab_cb(void *data, const char * path)
412 mf_retm_if(data == NULL, "data is NULL");
413 mf_retm_if(path == NULL, "path is NULL");
414 struct appdata *ap = (struct appdata *)data;
416 const char *label = NULL;
417 Evas_Object *pNaviBar = NULL;
418 myfileNaviBar *pNavi_s_toshow = NULL;
419 myfileNaviBar *pNavi_s_inuse = NULL;
421 Elm_Object_Item *it = NULL;
422 it = (Elm_Object_Item *)event_info;
423 label = elm_object_item_text_get(it);
426 optStorage = mf_fm_svc_wrapper_get_location(path);
427 switch (optStorage) {
429 label = GET_SYS_STR(MF_LABEL_PHONE);
432 label = GET_SYS_STR(MF_LABEL_MMC);
435 label = GET_STR(MF_LABEL_OTG);
442 if (ap->mf_Status.more == MORE_RENAME)
443 mf_callback_destory_rename(ap);
446 pNavi_s_inuse = mf_navi_bar_get_in_use(ap);
447 if (pNavi_s_inuse == NULL || pNavi_s_inuse->pNaviLabel == NULL) {
453 if (ap->mf_MainWindow.pNaviItem) {
454 mf_navi_bottom_item_del(&ap->mf_MainWindow.pNaviItem);
458 if (ap->mf_Status.more == MORE_EDIT)
459 ap->mf_Status.more = MORE_DEFAULT;
460 #ifdef MYFILE_SPLIT_VIEW
461 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
462 mf_callback_storage_cb(ap, label);
467 /*0. set the previous navi to be out of use */
468 pNavi_s_inuse->naviFlagInUse = FALSE;
469 /*1. get navi bar pointer by the label */
470 pNaviBar = ap->mf_MainWindow.pNaviBar;
471 pNavi_s_toshow = mf_navi_bar_get_navi_from_navilist(ap->mf_MainWindow.plistNaviBar, label);
472 /*2. create navi bar if not created, otherwise get it by pNaviBar */
473 if (pNavi_s_toshow == NULL) {
474 /*2.0 get root path by storage label */
475 char *rootpath = mf_fm_svc_wrapper_get_root_path_by_tab_label(label);
476 if (rootpath == NULL) {
480 /*2.1 create the navi for the tab */
481 pNavi_s_toshow = malloc(sizeof(myfileNaviBar));
482 if (pNavi_s_toshow == NULL) {
485 mf_debug("pNavi_s_toshow is NULL");
489 memset(pNavi_s_toshow, 0, sizeof(myfileNaviBar));
491 pNavi_s_toshow->naviFlagInUse = TRUE;
492 /*2.2 set path as root path of the storage */
493 pNavi_s_toshow->pCurrentPath = g_strdup(rootpath);
494 pNavi_s_toshow->pNaviLabel = strdup(label);
496 /*2.3 insert phone navi into the navi_list */
497 ap->mf_MainWindow.plistNaviBar = eina_list_append(ap->mf_MainWindow.plistNaviBar, pNavi_s_toshow);
499 if (ap->mf_Status.path != NULL) {
500 g_string_free(ap->mf_Status.path, TRUE);
501 ap->mf_Status.path = NULL;
503 ap->mf_Status.path = g_string_new(pNavi_s_toshow->pCurrentPath);
504 if (ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
505 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE) {
506 pNavi_s_toshow->pre_operation.path = g_string_new(pNavi_s_toshow->pCurrentPath);
507 mf_navi_bar_create_path_select_view(ap);
508 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
509 pNavi_s_toshow->naviFlagEditJoin = TRUE;
511 mf_navi_bar_create_default_view(ap);
512 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
518 /*2.1 get the navi of the tab */
519 pNavi_s_toshow = mf_navi_bar_get_struct_by_label(ap, label);
520 pNavi_s_toshow->naviFlagInUse = TRUE;
521 char *rootpath = mf_fm_svc_wrapper_get_root_path_by_tab_label(label);
523 /*2.2 set related status value. */
524 SAFE_FREE_GSTRING(ap->mf_Status.path);
525 SAFE_FREE_CHAR(pNavi_s_toshow->pCurrentPath);
526 ap->mf_Status.path = g_string_new(rootpath);
527 pNavi_s_toshow->pCurrentPath = rootpath;
528 /*2.3 update the content to catch update */
529 /*Todo: How to ensure insert only once */
530 if ((ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
531 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE)) {
532 mf_navi_bar_create_path_select_view(ap);
533 pNavi_s_toshow->naviFlagEditJoin = TRUE;
535 mf_navi_bar_create_default_view(ap);
537 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
545 /******************************
546 ** Prototype : click_callback
548 ** Input : struct appdata* data
557 ** 1.Date : 2010/12/10
559 ** Modification : Created function
561 ******************************/
562 void mf_callback_upper_folder_cb(void *data)
564 struct appdata *ap = (struct appdata *)data;
567 if (ap->mf_Status.flagNaviPush) {
568 mf_debug("the transition of the naviframe is not finished");
572 GString *parent_path = NULL;
575 error_code = mf_util_is_mmc_on(&mmc_card);
577 parent_path = mf_fm_svc_wrapper_get_file_parent_path(ap->mf_Status.path);
579 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
580 mf_retm_if(pNavi_s == NULL, "get navi structure failed");
581 if (ap->mf_Status.path != NULL) {
582 g_string_free(ap->mf_Status.path, TRUE);
583 ap->mf_Status.path = NULL;
585 ap->mf_Status.path = parent_path;
587 if (pNavi_s->pCurrentPath != NULL) {
588 free(pNavi_s->pCurrentPath);
589 pNavi_s->pCurrentPath = NULL;
591 pNavi_s->pCurrentPath = g_strdup(parent_path->str);
593 if (ap->mf_Status.more == MORE_DEFAULT) {
594 mf_navi_bar_create_default_view(ap);
596 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
599 void mf_callback_upper_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
602 mf_retm_if(data == NULL, "data is NULL");
604 Evas_Object *upper_button_ic = (Evas_Object *)data;
605 elm_image_file_set(upper_button_ic, MF_TITLE_ICON_UPPER_PRESS, NULL);
608 void mf_callback_upper_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
611 mf_retm_if(data == NULL, "data is NULL");
613 Evas_Object *upper_button_ic = (Evas_Object *)data;
614 elm_image_file_set(upper_button_ic, MF_TITLE_ICON_UPPER, NULL);
617 void mf_callback_upper_click_cb(void *data, Evas_Object * obj, void *event_info)
620 struct appdata *ap = data;
623 if (ap->mf_Status.flagNaviPush) {
624 mf_debug("the transition of the naviframe is not finished");
628 if (ap->mf_Status.more == MORE_CREATE_FOLDER) {
632 if (ap->mf_Status.view_type == mf_view_root) {
635 mf_callback_remove_dir_watch();
637 if (ap->mf_Status.more == MORE_RENAME) {
638 mf_callback_destory_rename(ap);
641 if (ap->mf_MainWindow.pNaviItem) {
642 mf_navi_bottom_item_del(&ap->mf_MainWindow.pNaviItem);
645 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
646 mf_retm_if(pNavi_s == NULL, "get navi structure failed");
647 GString *parent_path = NULL;
649 if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
650 ap->mf_Status.view_type = mf_view_root;
651 #ifdef MYFILE_SPLIT_VIEW
652 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
653 mf_navi_bar_set_panes_navi_to_main(ap);
658 parent_path = mf_fm_svc_wrapper_get_file_parent_path(ap->mf_Status.path);
660 g_string_free(ap->mf_Status.path, TRUE);
661 ap->mf_Status.path = NULL;
662 ap->mf_Status.path = parent_path;
663 #ifdef MYFILE_USB_OTG
664 /* if click items under otg root path, it means some disk take into use*/
665 int storage = mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str);
666 if (storage == MYFILE_OTG) { /* a usb disk take into use */
667 char *dev_in_use = mf_otg_get_node_in_use(ap);
668 if (dev_in_use != NULL)
669 mf_otg_set_node_using_flag(ap, dev_in_use, FALSE);
673 if (pNavi_s->pCurrentPath != NULL) {
674 free(pNavi_s->pCurrentPath);
675 pNavi_s->pCurrentPath = NULL;
677 pNavi_s->pCurrentPath = g_strdup(parent_path->str);
682 mf_widget_refresh_view(ap);
687 #ifdef MYFILE_SPLIT_VIEW
688 void mf_callback_left_click_cb(struct appdata *data, GString * path, Elm_Object_Item *item)
691 mf_retm_if(data == NULL, "data is NULL");
692 mf_retm_if(path == NULL, "path is NULL");
693 mf_retm_if(path->str == NULL, "path->str is NULL");
695 struct appdata *ap = (struct appdata *)data;
697 if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL) {
700 if (ap->mf_Status.flagNaviPush) {
701 mf_debug("the transition of the naviframe is not finished");
705 Evas_Object *pGenlist = NULL;
707 int locate = mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str);
708 int click_locate = MYFILE_PHONE;
710 pGenlist = ap->mf_MainWindow.sSplitData.pSplitLeftGenlist;
712 click_locate = mf_fm_svc_wrapper_get_location(path->str);
714 if (locate == click_locate) {
720 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
721 mf_retm_if(pNavi_s == NULL, "get navi structure failed");
722 error_code = mf_util_is_mmc_on(&mmc_card);
723 if (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
724 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_SEARCH) {
725 SAFE_FREE_GSTRING(ap->mf_Status.path);
726 ap->mf_Status.path = g_string_new(path->str);
727 SAFE_FREE_CHAR(pNavi_s->pCurrentPath);
728 pNavi_s->pCurrentPath = g_strdup(path->str);
729 #ifdef MYFILE_USB_OTG
730 /* if click items under otg root path, it means some disk take into use*/
732 error_code = mf_file_attr_is_disk_link(path->str, &result);
733 if (error_code == 0 && result == TRUE) { /* a usb disk take into use */
735 **we don't need to set the previous device flag to be false
736 **because click cannot jump from one device to another
738 mf_otg_set_node_using_flag(ap, path->str,TRUE);
742 if (ap->mf_Status.more == MORE_DEFAULT) {
743 mf_navi_bar_create_default_view(ap);
744 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
745 } else if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
746 || ap->mf_Status.more == MORE_DATA_COPYING || ap->mf_Status.more == MORE_DATA_MOVING) {
747 mf_navi_bar_create_path_select_view(ap);
748 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
754 if (g_strcmp0(path->str, PHONE_FOLDER) == 0) {
755 mf_callback_storage_cb(ap, GET_SYS_STR(MF_LABEL_PHONE));
756 } else if (g_strcmp0(path->str, MEMORY_FOLDER) == 0) {
757 mf_callback_storage_cb(ap, GET_SYS_STR(MF_LABEL_MMC));
758 } else if (g_strcmp0(path->str, OTG_FOLDER) == 0) {
759 mf_callback_storage_cb(ap, GET_STR(MF_LABEL_OTG));
766 void mf_callback_click_cb(struct appdata *data, mfAction key, GString * path)
770 mf_debug("key:%d path:%s\n", key, path->str);
772 struct appdata *ap = data;
773 if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL) {
777 if (ap->mf_Status.flagNaviPush) {
778 mf_debug("the transition of the naviframe is not finished");
781 if (ap->mf_Status.view_type == mf_view_root) {
782 ap->mf_Status.view_type = mf_view_normal;
783 #ifdef MYFILE_SPLIT_VIEW
784 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
785 mf_navi_bar_reset_panes_main(ap);
788 mf_callback_tab_cb(ap, path->str);
791 GString *new_path = NULL;
797 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
798 mf_retm_if(pNavi_s == NULL, "get navi structure failed");
800 error_code = mf_util_is_mmc_on(&mmc_card);
801 if (ap->mf_Status.more == MORE_DEFAULT || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE
802 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_SEARCH) {
803 if (key == MFACTION_CLICK) {
804 if (mf_fm_svc_wrapper_is_dir(path)) {
805 if (ap->mf_Status.more == MORE_SEARCH) {
806 if (ap->mf_FileOperation.search_result_list) {
807 mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_list), MYFILE_TYPE_CHAR);
809 elm_object_focus_set(ap->mf_MainWindow.pSearchEntry, EINA_FALSE);
810 ap->mf_Status.more = MORE_DEFAULT;
811 #ifdef MYFILE_SPLIT_VIEW
812 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
813 mf_navi_bar_reset_panes_main(ap);
818 new_path = g_string_new(path->str);
820 #ifdef MYFILE_USB_OTG
821 /* if click items under otg root path, it means some disk take into use*/
823 error_code = mf_file_attr_is_disk_link(new_path->str, &result);
824 if (error_code == 0 && result == TRUE) { /* a usb disk take into use */
826 **we don't need to set the previous device flag to be false
827 **because click cannot jump from one device to another
829 mf_otg_set_node_using_flag(ap, new_path->str,TRUE);
833 if (ap->mf_Status.path != NULL) {
834 g_string_free(ap->mf_Status.path, TRUE);
835 ap->mf_Status.path = NULL;
837 ap->mf_Status.path = new_path;
839 if (pNavi_s->pCurrentPath != NULL) {
840 free(pNavi_s->pCurrentPath);
841 pNavi_s->pCurrentPath = NULL;
843 pNavi_s->pCurrentPath = g_strdup(new_path->str);
844 mf_widget_refresh_view(ap);
846 struct timeval mytime;
847 gettimeofday(&mytime, NULL);
848 mf_debug("[myfiles click time] %ld sec %ld usec \n", mytime.tv_sec, mytime.tv_usec);
851 ret = mf_launch_service(ap, path->str);
852 mf_debug("ret is %d\n", ret);
856 else if (key == MFACTION_FLICK) {
862 /******************************
863 ** Prototype : __mf_callback_imk_cancel_cb
865 ** Input : void *data
872 ** 1.Date : 2010/12/10
874 ** Modification : Created function
876 ******************************/
877 static int __mf_callback_imk_cancel_cb(void *data)
879 struct appdata *ap = (struct appdata *)data;
882 mf_callback_cancel_cb(ap, NULL, NULL);
886 /******************************
887 ** Prototype : __mf_callback_illegal_char_popup_cb
889 ** Input : void *data
898 ** 1.Date : 2010/12/10
900 ** Modification : Created function
902 ******************************/
903 static void __mf_callback_illegal_char_popup_cb(void *data, Evas_Object * obj, void *event_info)
905 struct appdata *ap = (struct appdata *)data;
907 Evas_Object *btn = (Evas_Object *)obj;
908 const char *label = elm_object_text_get(btn);
910 if (g_strcmp0(label, GET_SYS_STR(MF_BUTTON_LABEL_YES)) == 0 ) {
911 evas_object_del(ap->mf_MainWindow.pNormalPopup);
912 ap->mf_MainWindow.pNormalPopup = NULL;
914 Evas_Object *entry = ap->mf_MainWindow.pEntry;
916 elm_object_focus_set(entry, EINA_TRUE);
917 } else if (g_strcmp0(label, GET_SYS_STR(MF_BUTTON_LABEL_NO)) == 0 ) {
918 evas_object_del(ap->mf_MainWindow.pNormalPopup);
919 ap->mf_MainWindow.pNormalPopup = NULL;
920 ecore_idler_add((Ecore_Task_Cb) __mf_callback_imk_cancel_cb, ap);
925 /******************************
926 ** Prototype : __mf_ime_mkdir_cb
928 ** Input : void *data
936 ** 1.Date : 2010/12/10
938 ** Modification : Created function
940 ******************************/
941 static int __mf_callback_ime_mkdir_cb(void *data, char *fileName)
944 struct appdata *ap = (struct appdata *)data;
949 const char *message = NULL;
950 const char *left_label = NULL;
951 const char *right_label = NULL;
953 left_label = GET_SYS_STR(MF_BUTTON_LABEL_YES);
954 right_label = GET_SYS_STR(MF_BUTTON_LABEL_NO);
955 if (strlen(fileName)) {
957 if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL) {
958 mf_debug("ap->mf_Status.path is NULL\n");
959 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
961 GString *fullpathdir = g_string_new(ap->mf_Status.path->str);
963 if (fullpathdir == NULL) {
964 mf_util_operation_alloc_failed(ap);
965 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
968 gchar *test_space = g_strstrip(fileName);
969 if (test_space == NULL) {
970 g_string_free(fullpathdir, TRUE);
972 mf_util_operation_alloc_failed(ap);
973 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
975 mf_debug("====================================fileName is [%s] test_space is [%s]", fileName, test_space);
977 GString *fullpathname = g_string_new(test_space);
979 if (fullpathname == NULL) {
980 g_string_free(fullpathdir, TRUE);
982 mf_util_operation_alloc_failed(ap);
983 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
986 if (strlen(test_space) == 0) {
987 message = GET_STR(MF_POPUP_MSG_NAME_INVALID); /*TODO */
988 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
989 left_label, right_label, NULL,
990 __mf_callback_illegal_char_popup_cb, ap);
992 g_string_free(fullpathdir, TRUE);
994 g_string_free(fullpathname, TRUE);
996 return MYFILE_ERR_DIR_CREATE_FAIL;
999 /*check if input name is valid */
1000 if (mf_file_attr_is_valid_name(fullpathname->str) == MYFILE_ERR_INVALID_FILE_NAME) {
1002 message = GET_STR(MF_MSG_ILLEGAL_CHAR);
1003 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1004 left_label, right_label, NULL,
1005 __mf_callback_illegal_char_popup_cb, ap);
1006 mf_debug("Name contains illegal character!!!");
1007 g_string_free(fullpathdir, TRUE);
1009 g_string_free(fullpathname, TRUE);
1010 fullpathname = NULL;
1012 return MYFILE_ERR_DIR_CREATE_FAIL;
1015 GString *fullpath = NULL;
1016 char *temp_fullpath = g_strconcat(fullpathdir->str, "/", fullpathname->str, NULL);
1017 if (temp_fullpath) {
1018 fullpath = g_string_new(temp_fullpath);
1020 free(temp_fullpath);
1021 temp_fullpath = NULL;
1022 if (fullpath == NULL) {
1023 g_string_free(fullpathdir, TRUE);
1025 g_string_free(fullpathname, TRUE);
1026 fullpathname = NULL;
1027 mf_util_operation_alloc_failed(ap);
1028 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
1031 g_string_free(fullpathdir, TRUE);
1033 g_string_free(fullpathname, TRUE);
1034 fullpathname = NULL;
1035 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
1038 mf_debug("length is %d\n", strlen(fileName));
1039 mf_debug("fullpath is %s\n", fullpath->str);
1040 /*check whether DIR name is override(DIR name has no extention) */
1041 /*check whether path length is override */
1042 if ((strlen(fullpathdir->str) + strlen(fullpathname->str)) > MYFILE_FILE_PATH_LEN_MAX) {
1044 message = GET_STR(MF_MSG_PATH_REACH_MAX_LEN);
1045 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1046 left_label, right_label, NULL,
1047 __mf_callback_illegal_char_popup_cb, ap);
1048 mf_debug("Full path length should be less than 4096 Retry!!!");
1049 g_string_free(fullpathdir, TRUE);
1051 g_string_free(fullpathname, TRUE);
1052 fullpathname = NULL;
1053 ret = MYFILE_ERR_DIR_CREATE_FAIL;
1055 /*check if duplicated name */
1056 else if (mf_file_attr_is_duplicated_name(ap->mf_Status.path->str, test_space) == MYFILE_ERR_DUPLICATED_NAME) {
1057 message = GET_STR(MF_MSG_DUP_NAME);
1058 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1059 left_label, right_label, NULL,
1060 __mf_callback_illegal_char_popup_cb, ap);
1062 mf_debug("Duplicated Name, Retry?");
1063 g_string_free(fullpathdir, TRUE);
1065 g_string_free(fullpathname, TRUE);
1066 fullpathname = NULL;
1067 ret = MYFILE_ERR_DIR_CREATE_FAIL;
1069 /*check if DIR name is all spaces */
1071 ret = mf_fm_svc_wrapper_create_service(ap, fullpath);
1072 /*check whether operate on read only area */
1073 if (errno == EROFS) {
1074 message = GET_STR(MF_MSG_OPER_READ_ONLY);
1075 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
1076 ret = MYFILE_ERR_DIR_CREATE_FAIL;
1078 message = GET_STR(MF_MSG_CREATE_DIR_FAILED);
1079 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
1080 mf_debug("create folder error %d \n", ret);
1083 g_string_free(fullpathdir, TRUE);
1085 g_string_free(fullpathname, TRUE);
1086 fullpathname = NULL;
1087 g_string_free(fullpath, TRUE);
1092 message = GET_STR(MF_MSG_EMPTY_FOLDER_NAME);
1094 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1095 left_label, right_label, NULL, __mf_callback_illegal_char_popup_cb, ap);
1096 ret = MYFILE_ERR_DIR_CREATE_FAIL;
1101 /******************************
1102 ** Prototype : mf_callback_cancel_cb
1104 ** Input : void *data
1113 ** 1.Date : 2010/12/10
1115 ** Modification : Created function
1117 ******************************/
1118 void mf_callback_cancel_cb(void *data, Evas_Object * obj, void *event_info)
1121 struct appdata *ap = (struct appdata *)data;
1122 mf_retm_if(ap == NULL, "ap is NULL");
1123 mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL");
1124 mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL");
1126 if (ap->mf_Status.flagNaviPush) {
1127 mf_debug("the transition of the naviframe is not finished");
1131 Evas_Object *newContent;
1133 Eina_List *l = NULL;
1135 myfileNaviBar *pNavi_s = NULL;
1136 myfileNaviBar *pNavi_toshow = NULL;
1138 switch (ap->mf_Status.more) {
1139 case MORE_INTERNAL_COPY:
1140 case MORE_INTERNAL_MOVE:
1141 case MORE_INTERNAL_COPY_MOVE:
1143 if (ap->mf_FileOperation.source != NULL) {
1144 g_string_free(ap->mf_FileOperation.source, TRUE);
1145 ap->mf_FileOperation.source = NULL;
1148 /*1.1 status set to default */
1149 ap->mf_Status.preMore = ap->mf_Status.more;
1150 ap->mf_Status.more = MORE_EDIT;
1151 flagTabbar = mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str);
1152 /*1.2 free the path to set it to the one just when edit clicked later */
1153 g_string_free(ap->mf_Status.path, TRUE);
1154 ap->mf_Status.path = NULL;
1155 /*2. navigation bar state recovery */
1156 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
1157 pNavi_s = (myfileNaviBar *) item;
1158 /*2.2 pop all the temprory views */
1159 /*2.3 recover the path just before when edit click */
1160 pNavi_s->pCurrentPath = strdup(pNavi_s->pre_operation.path->str);
1161 /*2.5 set navi related status */
1162 if (pNavi_s->naviFlagEditStart == TRUE) {
1163 /*2.5-1 set path in mf_status */
1164 ap->mf_Status.path = g_string_new(pNavi_s->pCurrentPath);
1165 /*2.5-2 set InUse flag */
1166 pNavi_s->naviFlagInUse = TRUE;
1167 /*2.5-3 set pNavi_toshow for refreshing */
1168 pNavi_toshow = pNavi_s;
1170 pNavi_s->naviFlagInUse = FALSE;
1174 if (pNavi_toshow == NULL) {
1175 mf_debug("pNavi_toshow is NULL");
1180 ap->mf_Status.more = MORE_DEFAULT;
1181 if (ap->mf_Status.view_type == mf_view_root) {
1182 ap->mf_Status.view_type = ap->mf_Status.preViewType;
1183 #ifdef MYFILE_SPLIT_VIEW
1184 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1185 if (ap->mf_Status.preViewType != mf_view_root_category) {
1186 mf_navi_bar_reset_panes_main(ap);
1191 ap->mf_Status.view_type = ap->mf_Status.preViewType;
1192 #ifdef MYFILE_SPLIT_VIEW
1193 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1194 if (ap->mf_Status.preViewType == mf_view_root_category) {
1195 mf_navi_bar_set_panes_navi_to_main(ap);
1201 mf_navi_bar_create_default_view(ap);
1202 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
1204 ap->mf_Status.more = MORE_EDIT;
1205 mf_widget_refresh_view(ap);
1207 ap->mf_Status.preMore = MORE_DEFAULT;
1210 mf_callback_destory_rename(ap);
1211 if (ap->mf_Status.preMore == MORE_SEARCH) {
1215 /* when cancle rename, just destory the rename relative, and then the mode will change to Edit
1216 then do what cancle edit do, so here not need "break" */
1218 /*1 pop edit view */
1219 if (ap->mf_MainWindow.pLabelLayout) {
1220 mf_widget_unset_part_content(ap->mf_MainWindow.pNaviLayout, "sel_contents");
1221 if (ap->mf_MainWindow.pLabelLayout)
1222 evas_object_del(ap->mf_MainWindow.pLabelLayout);
1224 ap->mf_MainWindow.pLabelLayout = NULL;
1226 ap->mf_Status.flagFolderSelect = FALSE;
1227 ap->mf_Status.flagFileSelect = FALSE;
1228 pNavi_toshow = mf_navi_bar_get_in_use(ap);
1229 mf_retm_if(pNavi_toshow == NULL, "get navi in use failed");
1230 ap->mf_Status.more = MORE_DEFAULT;
1231 /*3. refresh the content of the view */
1233 mf_navi_bar_recover_info_box(ap, pNavi_toshow);
1234 Evas_Object *btn = NULL;
1235 btn = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, TITLE_LEFT_BTN);
1238 mf_genlist_update_default_view_item_style(ap);
1239 newContent = mf_navi_bar_content_create(ap);
1240 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newContent);
1242 //mf_ctrl_bar_reset(ap);
1243 mf_navi_bar_reset_ctrl_button(ap);
1244 mf_navi_add_back_button(ap);
1245 /*4. set tab enable */
1246 mf_navi_bar_title_set(ap);
1250 if (ap->mf_Status.more == MORE_SEARCH)
1251 ap->mf_MainWindow.pSearchViewSweepItem = NULL;
1252 #ifdef MYFILE_SPLIT_VIEW
1253 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1254 /**** 1. unset naviframe from mainlayout **/
1255 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
1256 mf_navi_bar_reset_panes_main(ap);
1261 if (ap->mf_FileOperation.search_IME_hide_timer != NULL) {
1262 ecore_timer_del(ap->mf_FileOperation.search_IME_hide_timer);
1263 ap->mf_FileOperation.search_IME_hide_timer = NULL;
1266 if (ap->mf_FileOperation.search_result_list) {
1267 mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.search_result_list), MYFILE_TYPE_CHAR);
1270 if (ap->mf_Status.search_handler > 0) {
1271 mf_search_stop(ap->mf_Status.search_handler);
1272 mf_search_finalize(&ap->mf_Status.search_handler);
1274 ap->mf_Status.more = MORE_DEFAULT;
1275 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1276 evas_object_del(ap->mf_MainWindow.pEntry);
1277 ap->mf_MainWindow.pSearchEntry = NULL;
1279 mf_widget_refresh_view(ap);
1280 ap->mf_Status.preMore = MORE_DEFAULT;
1283 case MORE_CREATE_FOLDER:
1284 #ifdef MYFILE_SPLIT_VIEW
1285 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1286 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
1287 mf_navi_bar_reset_panes_main(ap);
1291 ap->mf_Status.more = ap->mf_Status.preMore;
1292 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1293 evas_object_del(ap->mf_MainWindow.pEntry);
1294 ap->mf_MainWindow.pEntry = NULL;
1295 mf_widget_imf_hide_callback_del(ap->mf_MainWindow.pConformant);
1297 mf_widget_refresh_view(ap);
1301 case MORE_THUMBNAIL_RENAME:
1302 #ifdef MYFILE_SPLIT_VIEW
1303 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1304 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
1305 mf_navi_bar_reset_panes_main(ap);
1309 ap->mf_Status.more = MORE_DEFAULT;//ap->mf_Status.preMore;
1310 ap->mf_Status.preMore = MORE_THUMBNAIL_RENAME;
1311 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1312 evas_object_del(ap->mf_MainWindow.pEntry);
1313 ap->mf_MainWindow.pEntry = NULL;
1314 mf_widget_imf_hide_callback_del(ap->mf_MainWindow.pConformant);
1316 mf_widget_refresh_view(ap);
1317 ap->mf_Status.preMore = MORE_DEFAULT;
1320 ap->mf_Status.more = MORE_DEFAULT;
1321 /*4. set tab enable */
1325 if (ap->mf_MainWindow.pLabel) {
1326 evas_object_del(ap->mf_MainWindow.pLabel);
1327 ap->mf_MainWindow.pLabel = NULL;
1331 /******************************
1332 ** Prototype : __mf_popup_show_vk_cb
1333 ** Description : Samsung
1334 ** Input : void *data
1335 ** Evas_Object * obj
1343 ** 1.Date : 2010/12/10
1345 ** Modification : Created function
1347 ******************************/
1348 void mf_popup_show_vk_cb(void *data, Evas_Object *obj, void *event_info)
1351 struct appdata *ap = (struct appdata *)data;
1354 Evas_Object *pEntry = NULL;
1356 evas_object_del(ap->mf_MainWindow.pNormalPopup);
1358 ap->mf_MainWindow.pNormalPopup = NULL;
1360 pEntry = ap->mf_MainWindow.pEntry;
1361 elm_entry_cursor_end_set(ap->mf_MainWindow.pEntry);
1363 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_TRUE);
1368 static void __mf_callback_refresh_rename(void *data, GString *pre_name, GString *new_name)
1371 mf_retm_if(data == NULL, "data is NULL");
1372 mf_retm_if(pre_name == NULL, "pre_name is NULL");
1373 mf_retm_if(pre_name->str == NULL, "pre_name->str is NULL");
1374 mf_retm_if(new_name == NULL, "new_name is NULL");
1375 mf_retm_if(new_name->str == NULL, "new_name->str is NULL");
1376 struct appdata *ap = (struct appdata *)data;
1378 mfItemData_s *item_data = NULL;
1380 item_data = elm_object_item_data_get(ap->mf_FileOperation.rename_item);
1381 if (item_data == NULL) {
1385 if (g_string_equal(item_data->m_ItemName, pre_name)) {
1386 g_string_free(item_data->m_ItemName, TRUE);
1387 item_data->m_ItemName = g_string_new(new_name->str);
1388 elm_object_item_data_set(ap->mf_FileOperation.rename_item, item_data);
1389 elm_genlist_item_update(ap->mf_FileOperation.rename_item);
1390 if (ap->mf_Status.view_type == mf_view_root_category) {
1391 mf_util_update_item_from_list_by_name(&ap->mf_FileOperation.category_list, pre_name->str, new_name->str);
1394 mf_callback_destory_rename(ap);
1397 void mf_callback_destory_rename(void *data)
1400 struct appdata *ap = (struct appdata *)data;
1401 mf_retm_if(ap == NULL, "ap is null");
1403 if (ap->mf_Status.more != MORE_RENAME) {
1407 myfileNaviBar *pNavi_toshow = NULL;
1408 pNavi_toshow = mf_navi_bar_get_in_use(ap);
1409 mf_retm_if(pNavi_toshow == NULL, "get navi in use failed");
1411 ap->mf_Status.more = ap->mf_Status.preMore;
1412 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1413 if (ap->mf_FileOperation.file_name_suffix != NULL) {
1414 SAFE_FREE_CHAR(ap->mf_FileOperation.file_name_suffix);
1416 if (ap->mf_FileOperation.to_rename) {
1417 SAFE_FREE_GSTRING(ap->mf_FileOperation.to_rename);
1419 if (ap->mf_FileOperation.rename_item) {
1420 elm_genlist_item_flip_set(ap->mf_FileOperation.rename_item, EINA_FALSE);
1421 elm_genlist_item_select_mode_set(ap->mf_FileOperation.rename_item, ELM_OBJECT_SELECT_MODE_DEFAULT);
1422 elm_genlist_item_update(ap->mf_FileOperation.rename_item);
1423 ap->mf_FileOperation.rename_item = NULL;
1426 if (ap->mf_MainWindow.pEntry) {
1427 ap->mf_MainWindow.pEntry = NULL;
1430 if (ap->mf_Status.preMore == MORE_DEFAULT) {
1431 mf_navi_bar_set_upper_item_disable(ap, FALSE);
1432 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_DEFAULT_ALL, FALSE);
1433 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_DEFAULT_ALL, FALSE);
1435 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_EDIT_ALL, FALSE);
1436 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_EDIT_ALL, FALSE);
1438 if (ap->mf_Status.iCtrlDisableItem > 0) {
1439 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, ap->mf_Status.iCtrlDisableItem, TRUE);
1440 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, ap->mf_Status.iCtrlDisableItem, TRUE);
1447 /******************************
1448 ** Prototype : mf_callback_rename_save_cb
1459 ** 1.Date : 2010/12/10
1461 ** Modification : Created function
1463 ******************************/
1464 void mf_callback_rename_save_cb(void *ad, Evas_Object *obj, void *event_info)
1467 struct appdata *ap = (struct appdata *)ad;
1468 mf_retm_if(ap == NULL, "ap is NULL");
1471 Evas_Object *pEntry = NULL;
1472 const char *entry_data = NULL;
1473 int ret = MYFILE_ERR_NONE;
1474 const char *message = NULL;
1475 GString *from = NULL;
1477 char *pFullPath = NULL;
1479 if (ap->mf_Status.more != MORE_RENAME && ap->mf_Status.more != MORE_THUMBNAIL_RENAME) {
1483 if (ap->mf_Status.flagNaviPush) {
1484 mf_debug("the transition of the naviframe is not finished");
1489 pEntry = ap->mf_MainWindow.pEntry;
1490 if (pEntry == NULL && ap->mf_Status.more == MORE_RENAME) {
1491 mf_callback_destory_rename(ap);
1495 entry_data = elm_entry_entry_get(pEntry);
1497 name = elm_entry_markup_to_utf8(entry_data);
1499 message = GET_STR(MF_RENAME_MSG_GET_NAME_FAILED);
1500 goto INVAILD_NAME_EXIT;
1502 if (strlen(name) == 0 && ap->mf_Status.more == MORE_THUMBNAIL_RENAME)
1504 SAFE_FREE_CHAR(name);
1505 message = GET_STR(MF_MSG_GET_NAME_FAILED);
1506 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1507 GET_SYS_STR(MF_BUTTON_LABEL_YES), GET_SYS_STR(MF_BUTTON_LABEL_NO), NULL,
1508 __mf_callback_illegal_char_popup_cb, ap);
1512 message = GET_STR(MF_RENAME_MSG_GET_NAME_FAILED);
1513 goto INVAILD_NAME_EXIT;
1518 if (ap->mf_FileOperation.file_name_suffix != NULL && strlen(ap->mf_FileOperation.file_name_suffix) > 0) {
1519 pName = g_strconcat(name, ".", ap->mf_FileOperation.file_name_suffix, NULL);
1520 CHAR_CHECK_NULL_GOTO(pName, ALLOC_FAILED_EXIT);
1522 pName = g_strdup(name);
1523 CHAR_CHECK_NULL_GOTO(pName, ALLOC_FAILED_EXIT);
1526 GString *parent_path = mf_fm_svc_wrapper_get_file_parent_path(ap->mf_FileOperation.to_rename);
1527 GSTRING_CHECK_NULL_GOTO(parent_path, ALLOC_FAILED_EXIT);
1528 pFullPath = g_strconcat(parent_path->str, "/", pName, NULL);
1529 CHAR_CHECK_NULL_GOTO(pFullPath, ALLOC_FAILED_EXIT);
1530 SAFE_FREE_GSTRING(parent_path);
1532 switch (mf_util_is_valid_name_check(pName)) {
1534 case MF_INTERNAL_FILE_NAME_EMPTY:
1535 case MF_INTERNAL_FILE_NAME_IGNORE:
1536 message = GET_STR(MF_MSG_SET_NAME_DOT);
1537 goto INVAILD_NAME_EXIT;
1538 case MF_INTERNAL_FILE_NAME_CHUG:
1539 message = GET_STR(MF_MSG_SET_NAME_ALL_SPACE);
1540 goto INVAILD_NAME_EXIT;
1541 case MF_INTERNAL_FILE_NAME_MAX_LENGTH:
1542 message = GET_STR(MF_MSG_NAME_REACH_MAX_LEN);
1543 goto INVAILD_NAME_EXIT;
1544 case MF_INTERNAL_FILE_NAME_INVALID_CHAR:
1545 message = GET_STR(MF_MSG_ILLEGAL_CHAR);
1546 goto INVAILD_NAME_EXIT;
1547 case MF_INTERNAL_FILE_NAME_NULL:
1548 message = GET_STR(MF_MSG_NO_NAME_WARNING);
1549 goto INVAILD_NAME_EXIT;
1555 if (strlen(pFullPath) > MYFILE_FILE_PATH_LEN_MAX) {
1556 message = GET_STR(MF_MSG_PATH_REACH_MAX_LEN);
1557 goto INVAILD_NAME_EXIT;
1560 from = g_string_new(ap->mf_FileOperation.to_rename->str);
1561 GSTRING_CHECK_NULL_GOTO(from, ALLOC_FAILED_EXIT);
1562 to = g_string_new(pFullPath);
1563 GSTRING_CHECK_NULL_GOTO(from, ALLOC_FAILED_EXIT);
1565 if (!g_string_equal(from, to)) {
1566 ret = mf_fm_svc_wrapper_rename_service(ap, from, to);
1567 if (ret != MYFILE_ERR_NONE) {
1568 if (errno == EROFS) {
1569 message = GET_STR(MF_MSG_OPER_READ_ONLY);
1570 goto INVAILD_NAME_EXIT;
1571 } else if (ret == MYFILE_ERR_INVALID_DIR_NAME || ret == MYFILE_ERR_INVALID_FILE_NAME) {
1572 message = GET_STR(MF_MSG_ILLEGAL_CHAR);
1573 goto INVAILD_NAME_EXIT;
1574 } else if (ret == MYFILE_ERR_DUPLICATED_NAME) {
1575 message = GET_STR(MF_RENAME_MSG_DUP_NAME);
1576 goto INVAILD_NAME_EXIT;
1578 message = GET_STR(MF_MSG_UNKNOW_REASON_RENAME_FAILED);
1579 goto INVAILD_NAME_EXIT;
1582 if (ap->mf_Status.more == MORE_RENAME)
1583 __mf_callback_refresh_rename(ap, from, to);
1584 else if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME){
1585 #ifdef MYFILE_SPLIT_VIEW
1586 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1587 mf_navi_bar_reset_panes_main(ap);
1590 ap->mf_Status.more = MORE_DEFAULT;
1591 ap->mf_Status.preMore = MORE_THUMBNAIL_RENAME;
1592 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1593 evas_object_del(ap->mf_MainWindow.pEntry);
1594 ap->mf_MainWindow.pEntry = NULL;
1595 mf_widget_imf_hide_callback_del(ap->mf_MainWindow.pConformant);
1596 if (ap->mf_Status.view_type == mf_view_root_category) {
1597 mf_util_update_item_from_list_by_name(&ap->mf_FileOperation.category_list, from->str, to->str);
1600 mf_widget_refresh_view(ap);
1601 ap->mf_Status.preMore = MORE_DEFAULT;
1607 if (ap->mf_Status.more == MORE_RENAME)
1608 mf_callback_destory_rename(ap);
1609 else if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME){
1610 mf_callback_cancel_cb(ap, NULL, NULL);
1615 mf_callback_destory_rename(ap);
1619 SAFE_FREE_CHAR(name);
1620 SAFE_FREE_CHAR(pName);
1621 SAFE_FREE_CHAR(pFullPath);
1622 SAFE_FREE_GSTRING(from);
1623 SAFE_FREE_GSTRING(to);
1628 SAFE_FREE_CHAR(name);
1629 SAFE_FREE_CHAR(pName);
1630 SAFE_FREE_CHAR(pFullPath);
1631 SAFE_FREE_GSTRING(from);
1632 SAFE_FREE_GSTRING(to);
1634 if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME)
1636 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1637 GET_SYS_STR(MF_BUTTON_LABEL_YES), GET_SYS_STR(MF_BUTTON_LABEL_NO), NULL,
1638 __mf_callback_illegal_char_popup_cb, ap);
1641 mf_callback_destory_rename(ap);
1642 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, message, NULL, NULL, NULL, mf_popup_show_vk_cb, ap);
1649 SAFE_FREE_CHAR(name);
1650 SAFE_FREE_CHAR(pName);
1651 SAFE_FREE_CHAR(pFullPath);
1652 SAFE_FREE_GSTRING(from);
1653 mf_util_operation_alloc_failed(ap);
1660 /******************************
1661 ** Prototype : mf_callback_save_cb
1663 ** Input : void *data
1672 ** 1.Date : 2010/12/10
1674 ** Modification : Created function
1676 ******************************/
1677 void mf_callback_save_cb(void *data, Evas_Object *obj, void *event_info)
1680 struct appdata *ap = (struct appdata *)data;
1683 if (ap->mf_Status.flagNaviPush) {
1684 mf_debug("the transition of the naviframe is not finished");
1689 int noContentFlag = 0;
1690 const char *message = NULL;
1691 const char *left_label = NULL;
1692 const char *right_label = NULL;
1694 if (ap->mf_Status.more == MORE_RENAME || ap->mf_Status.more == MORE_THUMBNAIL_RENAME) {
1695 mf_callback_rename_save_cb(ap, NULL, NULL);
1696 } else if (ap->mf_Status.more == MORE_CREATE_FOLDER) {
1697 const char *entry_data = NULL;
1701 if (ap->mf_MainWindow.pEntry != NULL) {
1702 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ap->mf_MainWindow.pEntry);
1703 if (imf_context != NULL)
1704 ecore_imf_context_hide(imf_context);
1707 entry_data = elm_entry_entry_get(ap->mf_MainWindow.pEntry);
1710 name = elm_entry_markup_to_utf8(entry_data);
1712 message = GET_STR(MF_MSG_GET_NAME_FAILED);
1713 left_label = GET_SYS_STR(MF_BUTTON_LABEL_YES);
1714 right_label = GET_SYS_STR(MF_BUTTON_LABEL_NO);
1715 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_TWO_BTN, NULL, message,
1716 left_label, right_label, NULL,
1717 __mf_callback_illegal_char_popup_cb, ap);
1724 ret = __mf_callback_ime_mkdir_cb(ap, name);
1726 #ifdef MYFILE_SPLIT_VIEW
1727 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1728 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
1729 mf_navi_bar_reset_panes_main(ap);
1733 ap->mf_Status.more = ap->mf_Status.preMore;
1734 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
1735 evas_object_del(ap->mf_MainWindow.pEntry);
1736 ap->mf_MainWindow.pEntry = NULL;
1737 mf_widget_imf_hide_callback_del(ap->mf_MainWindow.pConformant);
1739 mf_widget_refresh_view(ap);
1741 if (ap->mf_Status.more == MORE_DEFAULT && noContentFlag) {
1742 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, false);
1743 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_NOCONTENT_VIEW, false);
1755 void mf_callback_popup_deleted_cb(void *data, Evas_Object * obj, void *event_info)
1757 struct appdata *ap = (struct appdata *)data;
1760 if (ap->mf_MainWindow.pNormalPopup != NULL) {
1761 evas_object_del(ap->mf_MainWindow.pNormalPopup);
1763 ap->mf_MainWindow.pNormalPopup = NULL;
1767 /******************************
1768 ** Prototype : mf_callback_launch_send_cb
1770 ** Input : void *data
1779 ** 1.Date : 2010/12/10
1781 ** Modification : Created function
1783 ******************************/
1784 void mf_callback_launch_send_cb(void *data, Evas_Object *obj, void *event_info)
1787 struct appdata *ap = (struct appdata *)data;
1790 if (ap->mf_FileRecordList.selected_files && mf_util_get_eina_list_len(ap->mf_FileRecordList.selected_files) > 0) {
1791 switch (ap->mf_Status.more) {
1792 case MORE_SENDVIABLUETOOTH:
1793 case MORE_SENDVIAEMAIL:
1794 case MORE_SENDVIAMESSAGE:
1795 mf_share_launch_multi_file(data);
1801 const char *message = GET_SYS_STR(MF_LABEL_NOTHING_SELECTED);
1802 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
1804 ap->mf_Status.more = MORE_EDIT;
1807 /******************************
1808 ** Prototype : __mf_callback_idle_launch_send_cb
1810 ** Input : void *data
1817 ** 1.Date : 2010/12/10
1819 ** Modification : Created function
1821 ******************************/
1822 static int __mf_callback_idle_launch_send_cb(void *data)
1824 struct appdata *ap = (struct appdata *)data;
1827 mf_callback_launch_send_cb(ap, NULL, NULL);
1832 /******************************
1833 ** Prototype : mf_callback_send_view_cb
1835 ** Input : void *data
1844 ** 1.Date : 2010/12/10
1846 ** Modification : Created function
1848 ******************************/
1849 void mf_callback_send_response_cb(void *data)
1851 struct appdata *ap = (struct appdata *)data;
1854 if (ap->mf_MainWindow.pContextPopup != NULL) {
1855 evas_object_del(ap->mf_MainWindow.pContextPopup);
1857 ap->mf_MainWindow.pContextPopup = NULL;
1859 ecore_idler_add((Ecore_Task_Cb) __mf_callback_idle_launch_send_cb, ap);
1863 /******************************
1864 ** Prototype : __mf_callback_refresh_list_by
1866 ** Input : void *data
1873 ** 1.Date : 2010/12/10
1875 ** Modification : Created function
1877 ******************************/
1878 static int __mf_callback_refresh_list_by(void *data)
1880 struct appdata *ap = (struct appdata *)data;
1882 Evas_Object *playout = ap->mf_MainWindow.pNaviLayout;
1883 mf_retvm_if(playout == NULL, 0, "get conformant failed");
1884 Evas_Object *newContent = NULL;
1885 #ifdef MYFILE_SPLIT_VIEW
1886 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1887 mf_split_view_left_genlist_refresh(ap);
1891 if (ap->mf_Status.flagNoContent != EINA_TRUE) {
1892 newContent = mf_navi_bar_content_create(ap);
1893 mfNaviBarSetContent(ap, playout, newContent);
1895 ap->mf_Status.more = MORE_DEFAULT;
1899 /******************************
1900 ** Prototype : __mf_callback_list_by_response_cb
1901 ** Description : Samsung
1902 ** Input : void *data
1911 ** 1.Date : 2010/12/10
1913 ** Modification : Created function
1915 ******************************/
1916 void mf_callback_list_by_response_cb(void *data)
1918 struct appdata *ap = (struct appdata *)data;
1921 if (ap->mf_MainWindow.pNormalPopup != NULL) {
1922 evas_object_del(ap->mf_MainWindow.pNormalPopup);
1924 ap->mf_MainWindow.pNormalPopup = NULL;
1926 ecore_idler_add((Ecore_Task_Cb) __mf_callback_refresh_list_by, ap);
1930 /******************************
1931 ** Prototype : mf_callback_list_by_view_cb
1933 ** Input : void *data
1942 ** 1.Date : 2010/12/10
1944 ** Modification : Created function
1946 ******************************/
1947 void mf_callback_list_by_view_cb(void *data, Evas_Object * obj, void *event_info)
1950 struct appdata *ap = (struct appdata *)data;
1952 if (ap->mf_Status.flagNaviPush) {
1953 mf_debug("the transition of the naviframe is not finished");
1956 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
1957 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TITLE_LIST_BTN, GET_STR(LABEL_SORT_BY),
1958 NULL, NULL, NULL, NULL, mf_callback_popup_deleted_cb, ap);
1961 /******************************
1962 ** Prototype : mf_callback_edit_cb
1964 ** Input : void *data
1973 ** 1.Date : 2010/12/10
1975 ** Modification : Created function
1977 ******************************/
1978 #ifdef MYFILE_SPLIT_VIEW
1979 static void __mf_callback_edit_init(void *data)
1982 mf_retm_if(data == NULL, "data is NULL");
1984 struct appdata *ap = (struct appdata*)data;
1985 //ap->mf_MainWindow.pEditView.pBox = NULL;
1986 ap->mf_MainWindow.pEditView.pGenlist = NULL;
1987 ap->mf_MainWindow.pEditView.pGengrid = NULL;
1988 //ap->mf_MainWindow.pEditView.pSelectAllCheckBox = NULL;
1989 //ap->mf_MainWindow.pEditView.pSelectAllLayout = NULL;
1990 //ap->mf_MainWindow.pEditView.pPathInfo = NULL;
1991 //ap->mf_MainWindow.pEditView.pInfoBox = NULL;
1992 ap->mf_MainWindow.pEditView.bSelectAllChecked = FALSE;;
1993 ap->mf_MainWindow.pEditView.iTotalCount = 0;
1994 ap->mf_MainWindow.pEditView.iCheckedCount = 0;
2000 static void __mf_callback_set_select_all_total_count(void *data)
2004 mf_retm_if(data == NULL, "data is NULL");
2006 struct appdata *ap = (struct appdata*)data;
2010 folder_len = eina_list_count(ap->mf_FileOperation.folder_list);
2011 file_len = eina_list_count(ap->mf_FileOperation.file_list);
2012 ap->mf_MainWindow.pEditView.iTotalCount = (folder_len + file_len);
2015 static void __mf_callback_save_edit_view_status(void *data)
2018 mf_retm_if(data == NULL, "data is NULL");
2020 struct appdata *ap = (struct appdata*)data;
2021 myfileNaviBar *pNavi_s = NULL;
2022 Eina_List *l = NULL;
2024 /*backup the edit point for every navigation bar to get recovery */
2025 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
2026 pNavi_s = (myfileNaviBar *) item;
2030 if (pNavi_s->pre_operation.path != NULL)
2031 g_string_free(pNavi_s->pre_operation.path, TRUE);
2032 pNavi_s->pre_operation.path = g_string_new(pNavi_s->pCurrentPath);
2034 if (pNavi_s->naviFlagInUse == TRUE) {
2035 pNavi_s->naviFlagEditStart = TRUE;
2036 pNavi_s->naviFlagEditJoin = TRUE;
2038 pNavi_s->naviFlagEditStart = FALSE;
2041 ap->mf_Status.preViewType = ap->mf_Status.view_type;
2047 void mf_callback_edit_cb(void *data, Evas_Object * obj, void *event_info)
2050 struct appdata *ap = (struct appdata *)data;
2052 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
2053 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
2055 ap->mf_Status.more = MORE_EDIT;
2056 mf_callback_remove_dir_watch();
2057 #ifdef MYFILE_SPLIT_VIEW
2058 __mf_callback_edit_init(ap);
2060 /*backup the edit point for every navigation bar to get recovery */
2061 __mf_callback_save_edit_view_status(ap);
2062 #ifdef MYFILE_USB_OTG
2063 /* if start from OTG, set node editstart flag */
2064 if (mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str)== MYFILE_OTG) {
2065 char *dev_in_use = mf_otg_get_node_in_use(ap);
2066 mf_otg_set_node_editstart_flag(ap, dev_in_use, TRUE);
2070 mf_navi_bar_create_edit_view(ap);
2072 mf_navi_bar_edit_list_update(ap);
2074 __mf_callback_set_select_all_total_count(ap);
2075 ap->mf_MainWindow.pEditView.bSelectAllChecked = EINA_FALSE;
2076 //elm_check_state_pointer_set(ap->mf_MainWindow.pEditView.pSelectAllCheckBox, &ap->mf_MainWindow.pEditView.bSelectAllChecked);
2078 /*disable all the tab item if tab exists */
2083 /******************************
2084 ** Prototype : mf_callback_icu_update_cb
2086 ** Input : void *data
2093 ** 1.Date : 2011/06/30
2095 ** Modification : Created function
2097 void mf_callback_icu_update_cb(void *data)
2099 ug_send_event(UG_EVENT_REGION_CHANGE);
2101 mf_debug("region changed");
2103 struct appdata *ap = (struct appdata *)data;
2105 if (ap->mf_Status.flagIcuInit == FALSE)
2107 /* finalize the previous icu session */
2108 mf_util_icu_finalize(ap);
2109 /* start a new icu session*/
2110 mf_util_icu_init(ap);
2111 /* check if we should refresh the list */
2112 int iSortTypeValue = 0;
2113 mf_util_get_vconf_value(VCONF_TYPE_SORT_TYPE, &iSortTypeValue);
2114 if (iSortTypeValue != MYFILE_SORT_BY_DATE_R2O && iSortTypeValue != MYFILE_SORT_BY_DATE_O2R) {
2118 if (ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.more == MORE_INTERNAL_COPY || ap->mf_Status.more == MORE_INTERNAL_MOVE)
2121 myfileNaviBar *pNaviInUse = mf_navi_bar_get_in_use(ap);
2122 if (pNaviInUse == NULL || ap->mf_MainWindow.pNaviLayout == NULL)
2125 /*get current genlist */
2126 Evas_Object *currgenlist = ap->mf_MainWindow.pNaviGenlist;
2127 if (currgenlist == NULL)
2130 evas_object_del(currgenlist);
2131 /*create new genlist */
2132 Evas_Object *newgenlist = mf_navi_bar_content_create(ap);
2133 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newgenlist);
2139 /******************************
2140 ** Prototype : mf_callback_new_folder_create_cb
2142 ** Input : void *data
2151 ** 1.Date : 2010/12/10
2153 ** Modification : Created function
2155 ******************************/
2156 void mf_callback_new_folder_create_cb(void *data, Evas_Object * obj, void *event_info)
2159 struct appdata *ap = (struct appdata *)data;
2163 if (ap->mf_Status.flagNaviPush) {
2164 mf_debug("the transition of the naviframe is not finished");
2167 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
2169 if (ap->mf_Status.more == MORE_CREATE_FOLDER)
2172 if (ap->mf_Status.folder_count >= MAX_FOLDER_COUNT) {
2173 const char *message = GET_STR(MF_MSG_FOLDER_NUM_MAX);
2174 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
2177 ap->mf_Status.preMore = ap->mf_Status.more;
2178 ap->mf_Status.more = MORE_CREATE_FOLDER;
2180 ret = mf_util_check_disk_space(ap);
2181 if (ret == MYFILE_ERR_NO_FREE_SPACE) {
2182 ap->mf_Status.more = MORE_DEFAULT;
2186 mf_navi_bar_create_new_folder_view(ap);
2187 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
2192 void mf_callback_rename_create_cb(void *data, Evas_Object * obj, void *event_info)
2195 mf_retm_if(data == NULL, "data is NULL");
2197 mfItemData_s *params = (mfItemData_s *) data;
2198 struct appdata *ap = (struct appdata *)params->ap;
2200 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
2202 if (ap->mf_Status.more == MORE_THUMBNAIL_RENAME)
2204 mf_widget_unset_part_content(ap->mf_MainWindow.pNaviLayout, "sel_contents");
2206 SAFE_FREE_OBJ(ap->mf_MainWindow.pLabelLayout);
2209 ap->mf_Status.preMore = ap->mf_Status.more;
2210 ap->mf_Status.more = MORE_THUMBNAIL_RENAME;
2212 ret = mf_util_check_disk_space(ap);
2214 mf_navi_bar_create_rename_view(params);
2215 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
2220 void mf_callback_max_len_reached_cb(void *data, Evas_Object * obj, void *event_info)
2223 struct appdata *ap = (struct appdata *)data;
2224 mf_retm_if(ap == NULL, "ap is NULL");
2225 mf_popup_indicator_popup(ap, mf_util_get_text(MF_LABEL_MAX_CHARACTER_REACHED));
2232 /******************************
2233 ** Prototype : mf_callback_init_operation_cancel
2234 ** Description : Samsung
2235 ** Input : void *data
2242 ** 1.Date : 2010/12/10
2244 ** Modification : Created function
2246 ******************************/
2247 void mf_callback_init_operation_cancel(void *data)
2250 struct appdata *ap = (struct appdata *)data;
2251 mf_retm_if(ap == NULL, "ap is NULL");
2253 if (ap->mf_FileOperation.pCancel) {
2254 mf_cancel_free(ap->mf_FileOperation.pCancel);
2255 ap->mf_FileOperation.pCancel = NULL;
2258 ap->mf_FileOperation.pCancel = mf_cancel_new();
2262 /******************************
2263 ** Prototype : __mf_callback_idle_refresh
2264 ** Description : Samsung
2265 ** Input : void *data
2272 ** 1.Date : 2010/12/10
2274 ** Modification : Created function
2276 ******************************/
2277 static int __mf_callback_idle_refresh(void *data)
2280 struct appdata *ap = (struct appdata *)data;
2281 mf_retvm_if(ap == NULL, 0, "ap is NULL");
2282 mf_util_refresh_screen(ap);
2285 return ECORE_CALLBACK_CANCEL;
2289 /******************************
2290 ** Prototype : __mf_callback_progress_bar_state_cb
2291 ** Description : Samsung
2292 ** Input : void *data
2299 ** 1.Date : 2010/12/10
2301 ** Modification : Created function
2303 ******************************/
2304 static void __mf_callback_progress_bar_state_cb(void *data)
2307 struct appdata *ap = (struct appdata *)data;
2308 mf_retm_if(ap == NULL, "ap is NULL");
2310 mf_fo_msg *msg = ap->mf_FileOperation.pMessage;
2311 char lable[10] = { '\0', };
2313 char count_label[10] = { '\0' };
2315 int total_count = 0;
2316 Evas_Object *layout = ap->mf_MainWindow.pProgressLayout;
2317 mf_retm_if(layout == NULL, "layout is NULL");
2319 value = (double)msg->current_size / msg->total_size;
2320 elm_progressbar_value_set(ap->mf_FileOperation.progress_bar, value);
2322 snprintf(lable, sizeof(lable), "%d%s", (int)(value * 100), "%");
2324 edje_object_part_text_set(elm_layout_edje_get(layout), "elm.text.left", lable);
2327 total_count = ap->mf_FileOperation.iTotalCount;
2328 count = msg->current_index;
2330 if (count <= total_count) {
2331 snprintf(count_label, sizeof(count_label), "%d/%d", count, total_count);
2333 edje_object_part_text_set(elm_layout_edje_get(layout), "elm.text.right", count_label);
2340 /******************************
2341 ** Prototype : mf_callback_progress_bar_cancel_cb
2342 ** Description : Samsung
2343 ** Input : void *data
2352 ** 1.Date : 2010/12/10
2354 ** Modification : Created function
2356 ******************************/
2357 void mf_callback_progress_bar_cancel_cb(void *data, Evas_Object * obj, void *event_info)
2360 struct appdata *ap = (struct appdata *)data;
2361 mf_retm_if(ap == NULL, "ap is NULL");
2363 mf_cancel_do_cancel(ap->mf_FileOperation.pCancel);
2364 mf_msg_request_handled_send();
2370 /******************************
2371 ** Prototype : mfCopyCB
2373 ** Input : void *data
2382 ** 1.Date : 2010/12/10
2384 ** Modification : Created function
2386 ******************************/
2387 void mf_callback_copy_move_cb(void *data, Evas_Object * obj, void *event_info)
2390 struct appdata *ap = (struct appdata *)data;
2391 mf_retm_if(ap == NULL, "ap is NULL");
2392 mf_retm_if(event_info == NULL, "event_info is NULL");
2394 if (ap->mf_Status.flagNaviPush) {
2395 mf_debug("the transition of the naviframe is not finished");
2400 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2401 const char *label = elm_object_item_text_get(item);
2403 printf("label is [%s]\n", label);
2404 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
2406 ap->mf_Status.flagFolderSelect = FALSE;
2407 ap->mf_Status.flagFileSelect = FALSE;
2409 if (ap->mf_FileRecordList.value_saver != NULL) {
2410 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
2411 ap->mf_FileRecordList.value_saver = NULL;
2413 ap->mf_FileRecordList.value_saver = mf_util_get_all_selected(ap);
2415 if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) {
2416 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, GET_SYS_STR(MF_LABEL_NOTHING_SELECTED),
2417 GET_SYS_STR(MF_BUTTON_LABEL_OK), NULL, NULL, mf_callback_warning_popup_cb, ap);
2421 if (ap->mf_FileOperation.source != NULL) {
2422 g_string_free(ap->mf_FileOperation.source, TRUE);
2423 ap->mf_FileOperation.source = NULL;
2425 ap->mf_FileOperation.source = g_string_new(ap->mf_Status.path->str);
2426 if (g_strcmp0(label, GET_SYS_STR(LABEL_MOVE)) == 0) {
2427 ap->mf_Status.more = MORE_INTERNAL_MOVE;
2428 } else if (g_strcmp0(label, GET_SYS_STR(LABEL_COPY)) == 0) {
2429 ap->mf_Status.more = MORE_INTERNAL_COPY;
2434 if (ap->mf_MainWindow.pLabelLayout) {
2435 mf_widget_unset_part_content(ap->mf_MainWindow.pNaviLayout, "sel_contents");
2436 if (ap->mf_MainWindow.pLabelLayout)
2437 evas_object_del(ap->mf_MainWindow.pLabelLayout);
2438 ap->mf_MainWindow.pLabelLayout = NULL;
2441 /*set Navigation Bar for Destination selection */
2442 ap->mf_Status.view_type = mf_view_root;
2443 #ifdef MYFILE_SPLIT_VIEW
2444 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
2445 mf_split_view_unset_right_content(ap);
2446 mf_widget_unset_main_layout_content(ap->mf_MainWindow.pMainLayout);
2447 mf_split_view_hide(ap);
2448 evas_object_show(ap->mf_MainWindow.pMainLayout);
2449 elm_object_part_content_set(ap->mf_MainWindow.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.pNaviBar);
2452 mf_widget_refresh_view(ap);
2458 /******************************
2459 ** Prototype : mf_callback_paste_here_cb
2461 ** Input : void *data
2470 ** 1.Date : 2010/12/10
2472 ** Modification : Created function
2474 ******************************/
2475 void mf_callback_paste_here_cb(void *data, Evas_Object * obj, void *event_info)
2478 struct appdata *ap = (struct appdata *)data;
2479 mf_retm_if(ap == NULL, "ap is NULL");
2481 if (ap->mf_Status.flagNaviPush) {
2482 mf_debug("the transition of the naviframe is not finished");
2488 GList *pSourceList = NULL;
2490 gchar *pDestPath = NULL;
2492 mf_retm_if(ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL");
2493 mf_retm_if(ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL");
2495 mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL");
2496 mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL");
2498 ap->mf_Status.more = MORE_DATA_COPYING;
2499 ap->mf_FileOperation.destination = ap->mf_Status.path;
2501 if (ap->mf_FileOperation.source && ap->mf_FileOperation.source->str) {
2502 source_len = strlen(ap->mf_FileOperation.source->str);
2505 if (ap->mf_FileOperation.destination && ap->mf_FileOperation.destination->str) {
2506 dest_len = strlen(ap->mf_FileOperation.destination->str);
2509 if (source_len == 0 || dest_len == 0) {
2513 /*glib api change */
2515 if (!mf_util_check_forbidden_operation(ap)) {
2518 if (source_len == dest_len && strcmp(ap->mf_FileOperation.destination->str, ap->mf_FileOperation.source->str) == 0) {
2519 ap->mf_FileOperation.refresh_type = TRUE;
2521 ap->mf_FileOperation.refresh_type = FALSE;
2524 mf_util_merge_eina_list_to_glist(ap->mf_FileRecordList.value_saver, &pSourceList);
2527 count = g_list_length(pSourceList);
2533 ap->mf_FileOperation.iTotalCount = count;
2534 pDestPath = g_strdup(ap->mf_Status.path->str);
2535 if (pDestPath == NULL) {
2536 g_list_free(pSourceList);
2542 mf_callback_init_operation_cancel(ap);
2543 ap->mf_FileOperation.iRequestType = MF_REQ_NONE;
2545 ap->mf_FileOperation.pSourceList = pSourceList;
2547 if (mf_copy_copy_items(pSourceList, pDestPath, ap->mf_FileOperation.pCancel, TRUE, ap) == 0) {
2548 ap->mf_FileOperation.iOperationSuccessFlag = TRUE;
2549 mf_callback_remove_dir_watch();
2550 ap->mf_MainWindow.pProgressPopup = mf_popup_create_pb_popup(ap, GET_SYS_STR(MF_MSG_COPYING), count, mf_callback_progress_bar_cancel_cb, ap);
2552 mf_util_exception_func(ap);
2562 /******************************
2563 ** Prototype : mf_move_here_cb
2565 ** Input : void *data
2574 ** 1.Date : 2010/12/10
2576 ** Modification : Created function
2578 ******************************/
2579 void mf_callback_move_here_cb(void *data, Evas_Object * obj, void *event_info)
2582 struct appdata *ap = (struct appdata *)data;
2583 mf_retm_if(ap == NULL, "ap is NULL");
2584 if (ap->mf_Status.flagNaviPush) {
2585 mf_debug("the transition of the naviframe is not finished");
2591 GList *pSourceList = NULL;
2593 gchar *pDestPath = NULL;
2595 mf_retm_if(ap->mf_FileOperation.source == NULL, "ap->mf_FileOperation.source is NULL");
2596 mf_retm_if(ap->mf_FileOperation.source->str == NULL, "ap->mf_FileOperation.source is NULL");
2598 mf_retm_if(ap->mf_Status.path == NULL, "ap->mf_Status.path is NULL");
2599 mf_retm_if(ap->mf_Status.path->str == NULL, "ap->mf_Status.path->str is NULL");
2600 ap->mf_Status.more = MORE_DATA_MOVING;
2602 ap->mf_FileOperation.destination = ap->mf_Status.path;
2604 if (ap->mf_FileOperation.source && ap->mf_FileOperation.source->str) {
2605 source_len = strlen(ap->mf_FileOperation.source->str);
2608 if (ap->mf_FileOperation.destination && ap->mf_FileOperation.destination->str) {
2609 dest_len = strlen(ap->mf_FileOperation.destination->str);
2612 if (source_len == 0 || dest_len == 0) {
2616 /*glib api change */
2617 if (!mf_util_check_forbidden_operation(ap)) {
2620 ap->mf_FileOperation.refresh_type = FALSE;
2623 mf_util_merge_eina_list_to_glist(ap->mf_FileRecordList.value_saver, &pSourceList);
2626 count = g_list_length(pSourceList);
2632 ap->mf_FileOperation.iTotalCount = count;
2633 pDestPath = g_strdup(ap->mf_Status.path->str);
2634 if (pDestPath == NULL) {
2635 g_list_free(pSourceList);
2641 mf_callback_init_operation_cancel(ap);
2642 ap->mf_FileOperation.iRequestType = MF_REQ_NONE;
2644 ap->mf_FileOperation.pSourceList = pSourceList;
2645 if (mf_move_move_items(pSourceList, pDestPath, ap->mf_FileOperation.pCancel, true, ap) == 0) {
2646 ap->mf_FileOperation.iOperationSuccessFlag = TRUE;
2647 mf_callback_remove_dir_watch();
2648 ap->mf_MainWindow.pProgressPopup = mf_popup_create_pb_popup(ap, GET_SYS_STR(MF_MSG_MOVING), count, mf_callback_progress_bar_cancel_cb, ap);
2650 mf_util_exception_func(ap);
2656 /******************************
2657 ** Prototype : __mf_callback_confirm_delete
2659 ** Input : void *data
2668 ** 1.Date : 2010/12/10
2670 ** Modification : Created function
2672 ******************************/
2673 static void __mf_callback_confirm_delete(void *data, Evas_Object * obj, void *event_info)
2675 struct appdata *ap = (struct appdata *)data;
2676 mf_retm_if(ap == NULL, "ap is NULL");
2678 Evas_Object *btn = (Evas_Object *)obj;
2679 const char *label = elm_object_text_get(btn);
2681 if (g_strcmp0(label, GET_SYS_STR(LABEL_CANCEL)) == 0 ) {
2682 evas_object_del(ap->mf_MainWindow.pNormalPopup);
2683 ap->mf_MainWindow.pNormalPopup = NULL;
2685 } else if (g_strcmp0(label, GET_SYS_STR(LABEL_DELETE)) == 0) {
2686 if (ap->mf_MainWindow.pNormalPopup) {
2687 evas_object_del(ap->mf_MainWindow.pNormalPopup);
2688 ap->mf_MainWindow.pNormalPopup = NULL;
2691 if (ap->mf_MainWindow.pLabelLayout) {
2692 mf_widget_unset_part_content(ap->mf_MainWindow.pNaviLayout, "sel_contents");
2693 if (ap->mf_MainWindow.pLabelLayout)
2694 evas_object_del(ap->mf_MainWindow.pLabelLayout);
2695 ap->mf_MainWindow.pLabelLayout = NULL;
2698 ap->mf_FileOperation.refresh_type = TRUE;
2700 /*setting item check */
2701 Eina_List *selected_list = mf_util_get_all_selected(ap);
2703 if (ap->mf_FileRecordList.value_saver != NULL) {
2704 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
2705 ap->mf_FileRecordList.value_saver = NULL;
2707 ap->mf_FileRecordList.value_saver = selected_list;
2709 if (mf_util_get_eina_list_len(ap->mf_FileRecordList.value_saver) < 1) {
2710 ap->mf_MainWindow.pNormalPopup =
2711 mf_popup_create_popup(ap, POPMODE_TEXT_BTN, NULL, GET_SYS_STR(MF_LABEL_NOTHING_SELECTED),
2712 GET_SYS_STR(MF_BUTTON_LABEL_OK), NULL, NULL, mf_callback_warning_popup_cb, ap);
2714 GList *pSourceList = NULL;
2717 mf_util_merge_eina_list_to_glist(ap->mf_FileRecordList.value_saver, &pSourceList);
2719 count = g_list_length(pSourceList);
2725 ap->mf_FileOperation.iTotalCount = count;
2726 mf_callback_init_operation_cancel(ap);
2727 ap->mf_Status.more = MORE_DELETE;
2728 ap->mf_FileOperation.iRequestType = MF_REQ_NONE;
2730 ap->mf_FileOperation.pSourceList = pSourceList;
2731 mf_callback_remove_dir_watch();
2733 if (mf_delete_items(pSourceList, ap->mf_FileOperation.pCancel, TRUE, ap) == 0) {
2734 ap->mf_FileOperation.iOperationSuccessFlag = TRUE;
2735 mf_callback_remove_dir_watch();
2736 ap->mf_MainWindow.pProgressPopup =
2737 mf_popup_create_pb_popup(ap, GET_SYS_STR(MF_MSG_DELETING), count, mf_callback_progress_bar_cancel_cb, ap);
2739 mf_util_exception_func(ap);
2745 /******************************
2746 ** Prototype : mf_callback_delete_cb
2748 ** Input : void *data
2757 ** 1.Date : 2010/12/10
2759 ** Modification : Created function
2761 ******************************/
2762 void mf_callback_delete_cb(void *data, Evas_Object * obj, void *event_info)
2764 struct appdata *ap = (struct appdata *)data;
2766 if (ap->mf_Status.flagNaviPush) {
2767 mf_debug("the transition of the naviframe is not finished");
2770 mf_debug("delete clicked\n");
2771 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TITLE_TEXT_TWO_BTN,
2773 GET_SYS_STR(MF_BUTTON_LABEL_DEL),
2774 GET_SYS_STR(LABEL_DELETE), GET_SYS_STR(LABEL_CANCEL), NULL, __mf_callback_confirm_delete, ap);
2778 /******************************
2779 ** Prototype : mf_callback_thread_pipe_cb
2781 ** Input : void *data
2783 ** unsigned int nbyte
2790 ** 1.Date : 2010/12/10
2792 ** Modification : Created function
2794 ******************************/
2795 void mf_callback_operation_request_rename_cb(void *data, Evas_Object * obj, void *event_info)
2798 struct appdata *ap = (struct appdata *)data;
2799 mf_retm_if(ap == NULL, "ap is NULL");
2801 mf_fo_request *request = ap->mf_FileOperation.pRequest;
2803 if (ap->mf_MainWindow.pProgressPopup) {
2804 evas_object_show(ap->mf_MainWindow.pProgressPopup);
2807 ap->mf_FileOperation.iRequestType = MF_REQ_RENAME;
2808 mf_request_set_result(request, MF_REQ_RENAME);
2813 void mf_callback_operation_request_replace_cb(void *data, Evas_Object * obj, void *event_info)
2816 struct appdata *ap = (struct appdata *)data;
2817 mf_retm_if(ap == NULL, "ap is NULL");
2819 mf_fo_request *request = ap->mf_FileOperation.pRequest;
2821 if (ap->mf_MainWindow.pProgressPopup) {
2822 evas_object_show(ap->mf_MainWindow.pProgressPopup);
2825 ap->mf_FileOperation.iRequestType = MF_REQ_MERGE;
2826 if (ap->mf_FileOperation.refresh_type == TRUE) {
2827 mf_request_set_result(request, MF_REQ_SKIP);
2829 mf_request_set_result(request, MF_REQ_MERGE);
2835 void mf_callback_operation_request_cancel_cb(void *data, Evas_Object * obj, void *event_info)
2838 struct appdata *ap = (struct appdata *)data;
2839 mf_retm_if(ap == NULL, "ap is NULL");
2841 mf_fo_request *request = ap->mf_FileOperation.pRequest;
2843 if (ap->mf_MainWindow.pProgressPopup) {
2844 evas_object_show(ap->mf_MainWindow.pProgressPopup);
2847 mf_request_set_result(request, MF_REQ_CANCEL);
2853 void mf_callback_thread_pipe_cb(void *data, void *buffer, unsigned int nbyte)
2856 mf_debug(":::::::::: Main thread id = %d ::::::::::", (int)pthread_self());
2857 struct appdata *ap = (struct appdata *)data;
2858 mf_retm_if(ap == NULL, "ap is NULL");
2860 mf_fo_msg *pPipeMsg = (mf_fo_msg *) buffer;
2861 char *message = NULL;
2864 if (!MYFILE_MAGIC_CHECK(pPipeMsg, MYFILE_MAGIC_PIPE_DATA)) {
2865 mf_error(":::::::::::::p_pipe_data ERROR:::::::::::::");
2868 ap->mf_FileOperation.pMessage = pPipeMsg;
2869 ap->mf_FileOperation.pRequest = pPipeMsg->request;
2870 ap->mf_FileOperation.sync_pipe = pPipeMsg->pipe;
2871 mf_debug("::::::::::: pPipeMsg->msg_type is [%d]", pPipeMsg->msg_type);
2873 mf_util_set_pm_lock(ap, EINA_TRUE);
2874 switch (pPipeMsg->msg_type) {
2878 mf_msg_request_handled_send();
2880 case MF_MSG_CANCELLED:
2881 if (ap->mf_MainWindow.pProgressPopup) {
2882 evas_object_del(ap->mf_MainWindow.pProgressPopup);
2883 ap->mf_MainWindow.pProgressPopup = NULL;
2885 ap->mf_MainWindow.pFinishPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
2886 "Canceling...", NULL, NULL, NULL, NULL, NULL);
2887 mf_msg_request_handled_send();
2888 ap->mf_FileOperation.iOperationSuccessFlag = FALSE;
2891 if (ap->mf_Status.view_type == mf_view_root_category && (ap->mf_Status.more == MORE_DELETE || ap->mf_Status.more == MORE_IDLE_DELETE)) {
2892 mf_util_remove_item_from_list_by_name(&ap->mf_FileOperation.category_list, pPipeMsg->current_real);
2894 __mf_callback_progress_bar_state_cb(ap);
2895 mf_msg_request_handled_send();
2897 case MF_MSG_REQUEST:
2898 if (ap->mf_FileOperation.iRequestType == MF_REQ_RENAME) {
2899 mf_request_set_result(pPipeMsg->request, MF_REQ_RENAME);
2901 } else if (ap->mf_FileOperation.iRequestType == MF_REQ_MERGE) {
2902 if (ap->mf_FileOperation.refresh_type == TRUE) {
2903 mf_request_set_result(pPipeMsg->request, MF_REQ_SKIP);
2905 mf_request_set_result(pPipeMsg->request, MF_REQ_MERGE);
2908 ap->mf_FileOperation.iRequestType = MF_REQ_RENAME;
2909 mf_request_set_result(pPipeMsg->request, MF_REQ_RENAME);
2913 error_type = FO_ERROR_CHECK(pPipeMsg->error_code);
2914 switch (error_type) {
2915 case MF_FO_ERR_PERMISSION:
2916 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_PERMISSION_ERR), NULL);
2918 case MF_FO_ERR_ARGUMENT:
2919 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_ARG_ERR), NULL);
2921 case MF_FO_ERR_FAULT:
2922 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_FAULT_ERR), NULL);
2924 case MF_FO_ERR_TYPE:
2925 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_FILE_TYPE_ERR), NULL);
2927 case MF_FO_ERR_MAX_OPEN:
2928 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_MAX_OPEN_ERR), NULL);
2930 case MF_FO_ERR_SPACE:
2931 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_NO_SPACE), NULL);
2934 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_RO_ERR), NULL);
2936 case MF_FO_ERR_LOOP:
2937 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_LOOP_ERR), NULL);
2940 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_MEM_ERR), NULL);
2942 case MF_FO_ERR_NOT_EXIST:
2943 message = g_strconcat("Operation failed<br>", GET_SYS_STR(MF_LABEL_FILE_NOT_EXIST), NULL);
2945 case MF_FO_ERR_LONG_NAME:
2946 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_LONG_NAME_ERR), NULL);
2948 case MF_FO_ERR_BIG_SIZE:
2949 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_BIG_SIZE_ERR), NULL);
2951 case MF_FO_ERR_UNKNOWN:
2952 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_UNKNOWN_ERR), NULL);
2955 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_IO_ERR), NULL);
2958 message = g_strconcat("Operation failed<br>", GET_STR(MF_MSG_DEFAULT_ERR), NULL);
2962 if (ap->mf_MainWindow.pProgressPopup) {
2963 evas_object_del(ap->mf_MainWindow.pProgressPopup);
2964 ap->mf_MainWindow.pProgressPopup = NULL;
2967 if (ap->mf_MainWindow.pFinishPopup) {
2968 evas_object_del(ap->mf_MainWindow.pFinishPopup);
2969 ap->mf_MainWindow.pFinishPopup = NULL;
2972 SAFE_FREE_CHAR(ap->mf_FileOperation.pOperationMsg);
2973 if (error_type == MF_FO_ERR_SPACE) {
2974 ap->mf_FileOperation.pOperationMsg = message;
2976 if (ap->mf_Status.more == MORE_DATA_COPYING) {
2977 ap->mf_FileOperation.pOperationMsg = g_strdup(GET_STR(MF_MSG_COPY_FAILED));
2978 } else if (ap->mf_Status.more == MORE_DATA_MOVING) {
2979 ap->mf_FileOperation.pOperationMsg = g_strdup(GET_SYS_STR(MF_MSG_MOVE_FAILED));
2980 } else if (ap->mf_Status.more == MORE_DELETE || ap->mf_Status.more == MORE_IDLE_DELETE) {
2981 ap->mf_FileOperation.pOperationMsg = g_strdup(GET_SYS_STR(MF_LABEL_DELETE_FAILED));
2983 ap->mf_FileOperation.pOperationMsg = message;
2988 ap->mf_FileOperation.pGenlistItem = NULL;
2990 ap->mf_FileOperation.iOperationSuccessFlag = FALSE;
2991 mf_msg_request_handled_send();
2995 if (ap->mf_FileOperation.source) {
2996 g_string_free(ap->mf_FileOperation.source, TRUE);
2997 ap->mf_FileOperation.source = NULL;
2999 if (ap->mf_FileOperation.pSourceList) {
3000 g_list_free(ap->mf_FileOperation.pSourceList);
3001 ap->mf_FileOperation.pSourceList = NULL;
3003 if (ap->mf_MainWindow.pProgressPopup) {
3004 evas_object_del(ap->mf_MainWindow.pProgressPopup);
3005 ap->mf_MainWindow.pProgressPopup = NULL;
3007 ecore_idler_add((Ecore_Task_Cb)__mf_callback_idle_refresh, ap);
3008 if (pPipeMsg->pipe) {
3009 ecore_pipe_del(pPipeMsg->pipe);
3010 pPipeMsg->pipe = NULL;
3012 mf_msg_request_handled_send();
3014 mf_util_set_pm_lock(ap, EINA_FALSE);
3015 if (ap->mf_FileRecordList.value_saver != NULL) {
3016 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
3017 ap->mf_FileRecordList.value_saver = NULL;
3021 mf_msg_request_handled_send();
3028 void mf_callback_exception_popup_cb(void *data)
3030 struct appdata *ap = (struct appdata *)data;
3031 mf_retm_if(ap == NULL, "ap is NULL");
3033 if (ap->mf_MainWindow.pNormalPopup) {
3034 evas_object_del(ap->mf_MainWindow.pNormalPopup);
3035 ap->mf_MainWindow.pNormalPopup = NULL;
3038 mf_callback_cancel_cb(ap, NULL, NULL);
3041 /****** Memory card connection/removal handler ******/
3042 static void __mf_callback_mmc_connected(void *data)
3044 struct appdata *ap = (struct appdata *)data;
3045 mf_retm_if(ap == NULL, "appdata is NULL");
3046 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3048 Evas_Object *entry = NULL;
3049 ap->mf_Status.iStorageState |= MYFILE_MMC;
3051 if (ap->mf_Status.more == MORE_CREATE_FOLDER || ap->mf_Status.more == MORE_SEARCH || (ap->mf_Status.more == MORE_RENAME && ap->mf_Status.preMore == MORE_SEARCH))
3054 if (ap->mf_Status.view_type != mf_view_root) {
3058 mf_util_action_storage_insert(ap, GET_SYS_STR(MF_LABEL_MMC));
3059 if (ap->mf_Status.more == MORE_RENAME) {
3060 entry = ap->mf_MainWindow.pEntry;
3061 if (entry != NULL) {
3062 elm_object_focus_set(entry, EINA_TRUE);
3065 mf_navi_bar_title_set(ap);
3069 static void __mf_callback_mmc_remove_view_operation(void *data, int optStorage)
3071 struct appdata *ap = (struct appdata *)data;
3072 mf_retm_if(ap == NULL, "appdata is NULL");
3074 Evas_Object *parent = NULL;
3075 const char *labelStorage = NULL;
3076 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
3077 parent = ap->mf_MainWindow.pNaviGenlist;
3079 parent = ap->mf_MainWindow.pNaviGengrid;
3081 switch (optStorage) {
3083 labelStorage = PHONE_FOLDER;
3086 labelStorage = MEMORY_FOLDER;
3089 labelStorage = OTG_FOLDER;
3094 mf_widget_item_remove(parent, labelStorage, ap->mf_Status.flagViewType);
3095 #ifdef MYFILE_SPLIT_VIEW
3096 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3097 if (optStorage == MYFILE_MMC) {
3098 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3099 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3106 static void __mf_callback_mmc_remove_category_view_items(void *data, int optStorage)
3108 struct appdata *ap = (struct appdata *)data;
3109 mf_retm_if(ap == NULL, "appdata is NULL");
3111 Evas_Object *parent = NULL;
3112 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
3113 parent = ap->mf_MainWindow.pNaviGenlist;
3115 parent = ap->mf_MainWindow.pNaviGengrid;
3117 mf_widget_items_remove(parent, optStorage, ap->mf_Status.flagViewType);
3118 mf_util_remove_item_from_list_by_location(&ap->mf_FileOperation.category_list, optStorage);
3121 static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
3123 struct appdata *ap = (struct appdata *)data;
3124 mf_retm_if(ap == NULL, "appdata is NULL");
3125 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3127 Evas_Object *entry = NULL;
3128 char *labelStorage = NULL;
3129 MF_STORAGE optStorage = MYFILE_NONE;
3130 myfileNaviBar *pNaviInUseStruct = NULL;
3131 myfileNaviBar *pNaviToShowStruct = NULL;
3132 Evas_Object *pNaviBarStorageView = NULL;
3133 bool bEditStartFlag = FALSE;
3135 optStorage = storage;
3136 switch (optStorage) {
3138 labelStorage = GET_SYS_STR(MF_LABEL_PHONE);
3141 labelStorage = GET_SYS_STR(MF_LABEL_MMC);
3146 /*1.2.1 check if mmc is editstar navi */
3147 pNaviBarStorageView = ap->mf_MainWindow.pNaviBar;
3149 mf_debug("before remove is [%d]", ap->mf_Status.iStorageState);
3150 ap->mf_Status.iStorageState = (ap->mf_Status.iStorageState ^ optStorage);
3151 mf_debug("after remove is [%d]", ap->mf_Status.iStorageState);
3155 ** 1. status ap->mf_Status.more
3156 ** 2. is storage in Use ap->mf_Status.path
3157 ** 3. is source path in storage in inter-storage operation flagEditStartView
3160 if (ap->mf_Status.view_type == mf_view_root) {
3161 if(mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str) != optStorage) {
3162 switch (ap->mf_Status.more) {
3164 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3165 __mf_callback_mmc_remove_view_operation(ap, optStorage);
3167 case MORE_INTERNAL_COPY_MOVE:
3168 case MORE_INTERNAL_COPY:
3169 case MORE_INTERNAL_MOVE:
3170 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3171 if (bEditStartFlag == TRUE) {
3172 pNaviToShowStruct = mf_navi_bar_recover_list(ap);
3173 mf_navi_bar_refresh_recovered_view(ap, pNaviToShowStruct);
3175 __mf_callback_mmc_remove_view_operation(ap, optStorage);
3182 switch (ap->mf_Status.more) {
3184 ap->mf_Status.more = MORE_DEFAULT;
3185 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3186 __mf_callback_mmc_remove_view_operation(ap, optStorage);
3188 case MORE_INTERNAL_COPY_MOVE:
3189 case MORE_INTERNAL_COPY:
3190 case MORE_INTERNAL_MOVE:
3191 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3192 if (bEditStartFlag == TRUE) {
3193 mf_navi_bar_recover_list(ap);
3196 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3197 #ifdef MYFILE_SPLIT_VIEW
3199 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3200 if (optStorage == MYFILE_MMC) {
3201 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3202 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3207 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3213 } else if (ap->mf_Status.view_type == mf_view_root_category) {
3214 switch (ap->mf_Status.more) {
3218 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3219 __mf_callback_mmc_remove_category_view_items(ap, optStorage);
3224 } else if(mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str) != optStorage) {
3225 switch (ap->mf_Status.more) {
3228 case MORE_IDLE_DELETE:
3231 /* not a inter-storage operation */
3232 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3233 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3234 #ifdef MYFILE_SPLIT_VIEW
3235 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3236 if (optStorage == MYFILE_MMC) {
3237 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3238 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3244 #ifdef MYFILE_SPLIT_VIEW
3245 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3246 if (optStorage == MYFILE_MMC) {
3247 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3248 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3254 if (ap->mf_Status.more == MORE_RENAME) {
3255 entry = ap->mf_MainWindow.pEntry;
3256 if (entry != NULL) {
3257 elm_object_focus_set(entry, EINA_TRUE);
3262 case MORE_THUMBNAIL_RENAME:
3263 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3265 case MORE_CREATE_FOLDER:
3266 if (ap->mf_Status.preMore == MORE_DEFAULT) {
3267 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3269 } else if (ap->mf_Status.preMore == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.preMore == MORE_INTERNAL_COPY
3270 || ap->mf_Status.preMore == MORE_INTERNAL_MOVE) {
3271 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3272 if (bEditStartFlag == TRUE) {
3273 ap->mf_Status.more = MORE_DEFAULT;
3274 pNaviToShowStruct = mf_navi_bar_recover_list(ap);
3275 mf_navi_bar_refresh_recovered_view(ap, pNaviToShowStruct);
3278 if (bEditStartFlag == TRUE) {
3279 #ifdef MYFILE_SPLIT_VIEW
3280 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3281 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
3282 mf_navi_bar_reset_panes_main(ap);
3288 case MORE_INTERNAL_COPY:
3289 case MORE_INTERNAL_MOVE:
3290 case MORE_INTERNAL_COPY_MOVE:
3291 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3292 if (bEditStartFlag == TRUE) {
3293 pNaviToShowStruct = mf_navi_bar_recover_list(ap);
3294 mf_navi_bar_refresh_recovered_view(ap, pNaviToShowStruct);
3297 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3298 #ifdef MYFILE_SPLIT_VIEW
3299 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3300 if (optStorage == MYFILE_MMC) {
3301 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3302 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3308 #ifdef MYFILE_SPLIT_VIEW
3309 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3310 if (optStorage == MYFILE_MMC) {
3311 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3312 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3319 case MORE_DATA_COPYING:
3320 case MORE_DATA_MOVING:
3321 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3322 if (bEditStartFlag == TRUE) {
3323 ap->mf_Status.flagStorageRemoved = EINA_TRUE;
3325 ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
3326 "Mmc removed...", NULL, NULL, NULL, NULL, NULL);
3328 ap->mf_Status.flagStorageRemoved = EINA_FALSE;
3331 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3332 #ifdef MYFILE_SPLIT_VIEW
3333 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3334 if (optStorage == MYFILE_MMC) {
3335 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3336 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3342 #ifdef MYFILE_SPLIT_VIEW
3343 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3344 if (optStorage == MYFILE_MMC) {
3345 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3346 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3357 switch (ap->mf_Status.more) {
3359 ap->mf_Status.more = MORE_DEFAULT;
3360 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3361 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3362 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3363 #ifdef MYFILE_SPLIT_VIEW
3364 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3365 if (optStorage == MYFILE_MMC) {
3366 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3367 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3373 #ifdef MYFILE_SPLIT_VIEW
3374 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3375 if (optStorage == MYFILE_MMC) {
3376 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3377 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3382 /*set status path && refresh the screen */
3383 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3386 case MORE_THUMBNAIL_RENAME:
3387 if (ap->mf_FileOperation.search_IME_hide_timer != NULL) {
3388 ecore_timer_del(ap->mf_FileOperation.search_IME_hide_timer);
3389 ap->mf_FileOperation.search_IME_hide_timer = NULL;
3391 ap->mf_Status.more = MORE_DEFAULT;
3392 ap->mf_Status.preMore = MORE_DEFAULT;
3393 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3395 #ifdef MYFILE_SPLIT_VIEW
3396 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3397 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
3398 mf_navi_bar_reset_panes_main(ap);
3402 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3403 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3407 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3408 if (bEditStartFlag == TRUE) {
3409 mf_navi_bar_recover_list(ap);
3412 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3413 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3414 #ifdef MYFILE_SPLIT_VIEW
3415 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3416 if (optStorage == MYFILE_MMC) {
3417 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3418 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3424 #ifdef MYFILE_SPLIT_VIEW
3425 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3426 if (optStorage == MYFILE_MMC) {
3427 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3428 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3433 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3435 case MORE_IDLE_DELETE:
3437 ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
3438 "Mmc removed...", NULL, NULL, NULL, NULL, NULL);
3439 /*ToDo: check whether get the error before this; */
3440 if (ap->mf_FileOperation.pCancel) {
3441 mf_cancel_do_cancel(ap->mf_FileOperation.pCancel);
3444 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3446 ap->mf_Status.flagStorageRemoved = EINA_TRUE;
3448 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3449 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3450 #ifdef MYFILE_SPLIT_VIEW
3451 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3452 if (optStorage == MYFILE_MMC) {
3453 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3454 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3460 #ifdef MYFILE_SPLIT_VIEW
3461 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3462 if (optStorage == MYFILE_MMC) {
3463 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3464 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3469 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3472 if (ap->mf_Status.preMore == MORE_DEFAULT) {
3473 ap->mf_Status.more = MORE_DEFAULT;
3474 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3475 } else if (ap->mf_Status.preMore == MORE_EDIT) {
3476 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3477 ap->mf_Status.more = MORE_DEFAULT;
3478 mf_navi_bar_recover_list(ap);
3481 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3482 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3484 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3485 #ifdef MYFILE_SPLIT_VIEW
3486 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3487 if (optStorage == MYFILE_MMC) {
3488 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3489 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3495 #ifdef MYFILE_SPLIT_VIEW
3496 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3497 if (optStorage == MYFILE_MMC) {
3498 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3499 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3505 case MORE_CREATE_FOLDER:
3506 if (ap->mf_MainWindow.pEditField != NULL) {
3507 evas_object_hide(ap->mf_MainWindow.pEditField);
3509 if (ap->mf_Status.preMore == MORE_DEFAULT) {
3510 ap->mf_Status.more = MORE_DEFAULT;
3511 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3512 } else if (ap->mf_Status.preMore == MORE_INTERNAL_COPY_MOVE || ap->mf_Status.preMore == MORE_INTERNAL_COPY
3513 || ap->mf_Status.preMore == MORE_INTERNAL_MOVE) {
3514 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3515 if (bEditStartFlag == TRUE) {
3516 ap->mf_Status.more = MORE_DEFAULT;
3517 pNaviToShowStruct = mf_navi_bar_recover_list(ap);
3518 mf_navi_bar_refresh_recovered_view(ap, pNaviToShowStruct);
3520 ap->mf_Status.more = ap->mf_Status.preMore;
3525 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3526 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3527 #ifdef MYFILE_SPLIT_VIEW
3528 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3529 if (ap->mf_Status.view_type != mf_view_root_category && ap->mf_Status.view_type != mf_view_root) {
3530 mf_navi_bar_reset_panes_main(ap);
3536 case MORE_INTERNAL_COPY:
3537 case MORE_INTERNAL_MOVE:
3538 case MORE_INTERNAL_COPY_MOVE:
3539 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3540 if (bEditStartFlag == TRUE) {
3541 mf_navi_bar_recover_list(ap);
3544 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3546 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3547 #ifdef MYFILE_SPLIT_VIEW
3548 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3549 if (optStorage == MYFILE_MMC) {
3550 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3551 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3557 #ifdef MYFILE_SPLIT_VIEW
3558 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3559 if (optStorage == MYFILE_MMC) {
3560 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3561 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3566 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3569 case MORE_DATA_COPYING:
3570 case MORE_DATA_MOVING:
3571 ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
3572 "Mmc removed...", NULL, NULL, NULL, NULL, NULL);
3573 bEditStartFlag = mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3574 if (bEditStartFlag == TRUE) {
3575 ap->mf_Status.flagStorageRemoved = EINA_TRUE;
3577 ap->mf_Status.flagStorageRemoved = EINA_FALSE;
3580 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3581 /*reset the path for the navigation bar to show*/
3582 if (ap->mf_Status.path != NULL) {
3583 g_string_free(ap->mf_Status.path, TRUE);
3584 ap->mf_Status.path = NULL;
3586 ap->mf_Status.path = g_string_new(pNaviInUseStruct->pCurrentPath);
3588 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3589 /*check navigation bar count to decide the main layout content*/
3590 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3591 #ifdef MYFILE_SPLIT_VIEW
3592 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3593 if (optStorage == MYFILE_MMC) {
3594 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3595 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3601 #ifdef MYFILE_SPLIT_VIEW
3602 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3603 if (optStorage == MYFILE_MMC) {
3604 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3605 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3612 ap->mf_MainWindow.pMmcRemovedPopup = mf_popup_create_popup(ap, POPMODE_TEXT_NOT_DISABLED, NULL,
3613 "Mmc removed...", NULL, NULL, NULL, NULL, NULL);
3614 if (ap->mf_FileOperation.pCancel) {
3615 mf_cancel_do_cancel(ap->mf_FileOperation.pCancel);
3617 mf_navi_bar_remove_list_item_by_label(ap, labelStorage);
3618 pNaviInUseStruct = mf_navi_bar_get_in_use(ap);
3620 if (ap->mf_Status.iStorageState == MYFILE_PHONE) {
3621 #ifdef MYFILE_SPLIT_VIEW
3622 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3623 if (optStorage == MYFILE_MMC) {
3624 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3625 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3631 #ifdef MYFILE_SPLIT_VIEW
3632 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
3633 if (optStorage == MYFILE_MMC) {
3634 elm_object_item_del(ap->mf_MainWindow.sSplitData.mmc_item);
3635 ap->mf_MainWindow.sSplitData.mmc_item = NULL;
3640 mf_navi_bar_refresh_recovered_view(ap, pNaviInUseStruct);
3647 if (ap->mf_MainWindow.pMmcRemovedPopup) {
3649 evas_object_del(ap->mf_MainWindow.pMmcRemovedPopup);
3650 ap->mf_MainWindow.pMmcRemovedPopup = NULL;
3652 mf_navi_bar_title_set(ap);
3655 static void __mf_callback_storage_changed_cb(keynode_t *key, void *data)
3657 struct appdata *ap = (struct appdata *)data;
3658 mf_retm_if(ap == NULL, "appdata is NULL");
3659 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3660 int optStorage = MYFILE_NONE;
3662 if (VCONF_TYPE_INT == vconf_keynode_get_type(key)
3663 && VCONFKEY_SYSMAN_MMC_MOUNTED == vconf_keynode_get_int(key)) {
3664 if (!(ap->mf_Status.iStorageState & MYFILE_MMC)) {
3665 __mf_callback_mmc_connected(ap);
3670 if (VCONFKEY_SYSMAN_MMC_REMOVED == vconf_keynode_get_int(key)
3671 || VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED == vconf_keynode_get_int(key)) {
3672 mf_debug("mmc removed");
3673 optStorage = MYFILE_MMC;
3674 ap->mf_Status.flagStorageRemoved = EINA_TRUE;
3677 if (optStorage == MYFILE_NONE) {
3678 mf_debug("get removed storage failed\n");
3681 /*here we handle the remove action */
3682 if (ap->mf_Status.iStorageState & optStorage) {
3683 __mf_callback_mmc_removed(ap, optStorage);
3689 int mf_callback_set_mmc_state_cb(void *data)
3691 struct appdata *ap = (struct appdata *)data;
3693 mf_retvm_if(ap == NULL, -1, "appdata is NULL");
3695 mf_util_is_mmc_on(&mmc_state);
3696 return vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, __mf_callback_storage_changed_cb, ap);
3698 /****** end of Memory card connection/removal handler ******/
3700 /****** USB otg connection/removal handler ******/
3701 #ifdef MYFILE_USB_OTG
3702 static void __mf_callback_otg_removal_cb(keynode_t *key, void *data)
3704 struct appdata *ap = (struct appdata *)data;
3705 mf_retm_if(ap == NULL, "appdata is NULL");
3706 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3708 myfileNaviBar *pNaviStorageStruct = NULL;
3709 Evas_Object *pNaviBarStorageView = NULL;
3710 bool bAllRemovedFlag = FALSE; /*all otg devices are removed*/
3711 /* first generated the removed node list */
3712 mf_otg_generate_removed_list(ap);
3713 int count_original = eina_list_count(ap->mf_FileOperation.otg_dev_list);
3714 int count_removed = eina_list_count(ap->mf_FileOperation.otg_dev_removed_list);
3715 if(count_original > count_removed)
3716 bAllRemovedFlag = FALSE;
3718 bAllRemovedFlag = TRUE;
3719 /*1.2.1 check if otg is editstar navi */
3720 pNaviStorageStruct = mf_navi_bar_get_struct_by_label(ap, GET_STR(MF_LABEL_OTG));
3721 pNaviBarStorageView = ap->mf_MainWindow.pNaviBar;
3725 ** 1. status ap->mf_Status.more
3726 ** 2. is storage in Use ap->mf_Status.path
3727 ** 3. is source path in storage in inter-storage operation flagEditStartView
3730 if (bAllRemovedFlag == TRUE) { /*1. otg storage all removed*/
3731 /*we should check if tab bar need to be removed */
3732 switch (ap->mf_Status.more) {
3734 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_NOR_POPUP_DEL);
3737 if (pNaviStorageStruct && pNaviStorageStruct->naviFlagInUse == TRUE) {
3738 if (ap->mf_FileOperation.sync_pipe != NULL) {
3739 ecore_pipe_del(ap->mf_FileOperation.sync_pipe);
3740 ap->mf_FileOperation.sync_pipe = NULL;
3743 if (ap->mf_FileOperation.search_IME_hide_timer != NULL) {
3744 ecore_timer_del(ap->mf_FileOperation.search_IME_hide_timer);
3745 ap->mf_FileOperation.search_IME_hide_timer = NULL;
3748 if (ap->mf_Status.search_handler > 0) {
3749 mf_search_stop(ap->mf_Status.search_handler);
3752 if (ap->mf_Status.search_handler > 0) {
3753 mf_search_finalize(&ap->mf_Status.search_handler);
3757 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_NOR_POPUP_DEL);
3761 if (pNaviStorageStruct && pNaviStorageStruct->naviFlagInUse == TRUE)
3762 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_TABBAR_ENABLE | MF_OTG_OPT_THEME_RESET | MF_OTG_OPT_NOR_POPUP_DEL);
3764 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_THEME_RESET | MF_OTG_OPT_NOR_POPUP_DEL);
3766 case MORE_IDLE_DELETE:
3768 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_NONE);
3771 case MORE_CREATE_FOLDER:
3772 if (pNaviStorageStruct && (pNaviStorageStruct->naviFlagInUse == TRUE || pNaviStorageStruct->naviFlagEditStart == TRUE))
3773 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_TABBAR_ENABLE | MF_OTG_OPT_NOR_POPUP_DEL);
3775 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_NONE);
3777 case MORE_INTERNAL_COPY:
3778 case MORE_INTERNAL_MOVE:
3779 case MORE_INTERNAL_COPY_MOVE:
3780 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_NONE);
3782 case MORE_DATA_COPYING:
3783 case MORE_DATA_MOVING:
3784 mf_otg_dev_all_removed_update(ap, MF_OTG_OPT_REQ_POPUP_DEL);
3789 } else { /*otg storages part removed*/
3790 /*we don't need to check tab bar status*/
3791 mf_debug("not all removed");
3792 switch (ap->mf_Status.more) {
3794 mf_otg_dev_removed_update(ap, MF_OTG_OPT_NOR_POPUP_DEL);
3797 mf_otg_dev_removed_update(ap, MF_OTG_OPT_NOR_POPUP_DEL);
3800 if (pNaviStorageStruct && pNaviStorageStruct->naviFlagInUse == TRUE)
3801 mf_otg_dev_removed_update(ap, MF_OTG_OPT_TABBAR_ENABLE | MF_OTG_OPT_THEME_RESET | MF_OTG_OPT_NOR_POPUP_DEL);
3803 mf_otg_dev_removed_update(ap, MF_OTG_OPT_THEME_RESET | MF_OTG_OPT_NOR_POPUP_DEL);
3805 case MORE_IDLE_DELETE:
3807 mf_otg_dev_removed_update(ap, MF_OTG_OPT_NONE);
3810 case MORE_CREATE_FOLDER:
3811 if (pNaviStorageStruct && (pNaviStorageStruct->naviFlagInUse == TRUE || pNaviStorageStruct->naviFlagEditStart == TRUE))
3812 mf_otg_dev_removed_update(ap, MF_OTG_OPT_TABBAR_ENABLE | MF_OTG_OPT_NOR_POPUP_DEL);
3814 mf_otg_dev_removed_update(ap, MF_OTG_OPT_NONE);
3816 case MORE_INTERNAL_COPY:
3817 case MORE_INTERNAL_MOVE:
3818 case MORE_INTERNAL_COPY_MOVE:
3819 mf_otg_dev_removed_update(ap, MF_OTG_OPT_NONE);
3821 case MORE_DATA_COPYING:
3822 case MORE_DATA_MOVING:
3823 mf_otg_dev_removed_update(ap, MF_OTG_OPT_REQ_POPUP_DEL);
3830 mf_debug("before remove is [%d]", ap->mf_Status.iStorageState);
3831 if(bAllRemovedFlag == TRUE)
3832 ap->mf_Status.iStorageState = (ap->mf_Status.iStorageState ^ MYFILE_OTG);
3833 mf_debug("after remove is [%d]", ap->mf_Status.iStorageState);
3837 static void __mf_callback_otg_connected_cb(keynode_t *key, void *data)
3839 struct appdata *ap = (struct appdata *)data;
3840 mf_retm_if(ap == NULL, "appdata is NULL");
3841 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3842 Evas_Object *entry = NULL;
3844 /* otg-dev-list update */
3845 mf_debug("before update: [%d]", eina_list_count(ap->mf_FileOperation.otg_dev_list));
3846 mf_otg_list_update(ap, true);
3847 mf_debug("after update: [%d]", eina_list_count(ap->mf_FileOperation.otg_dev_list));
3849 * 1. otg tab already exists -- update the genlist
3850 * 2. otg tab does not exist -- add tab
3852 if (ap->mf_Status.iStorageState & MYFILE_OTG) {
3853 mf_debug("path is %s", ap->mf_Status.path->str);
3854 if (g_strcmp0(ap->mf_Status.path->str, OTG_FOLDER) == 0) {
3856 mf_util_ex_disk_list_update(ap);
3861 ap->mf_Status.iStorageState |= MYFILE_OTG;
3862 mf_util_action_storage_insert(ap, GET_STR(MF_LABEL_OTG));
3867 if (ap->mf_Status.more == MORE_RENAME) {
3868 entry = ap->mf_MainWindow.pEntry;
3869 if (entry != NULL) {
3870 elm_object_focus_set(entry, EINA_TRUE);
3876 void mf_callback_set_otg_state_cb(void *data)
3878 struct appdata *ap = (struct appdata *)data;
3879 mf_retm_if(ap == NULL, "appdata is NULL");
3880 mf_retm_if(ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL, "mf_Status.path is NULL");
3882 mf_debug("path is %s", ap->mf_Status.path->str);
3884 if (ap->mf_FileOperation.otg_dev_list != NULL) {
3885 mf_otg_list_clean(ap, MF_OTG_LIST_DEV);
3889 vconf_notify_key_changed(VCONFKEY_SYSMAN_ADDED_USB_STORAGE, __mf_callback_otg_connected_cb, ap);
3890 vconf_notify_key_changed(VCONFKEY_SYSMAN_REMOVED_USB_STORAGE, __mf_callback_otg_removal_cb, ap);
3893 /****** end of USB otg connection/removal handler ******/
3896 static GString *__mf_callback_dir_pipe_get_parent(GString *path)
3899 mf_retvm_if(path == NULL, NULL, "path is NULL");
3900 mf_retvm_if(path->str == NULL, NULL, "path->str is NULL");
3902 if (ecore_file_exists(path->str)) {
3904 } else if (mf_fm_svc_wrapper_is_root_path(path->str)) {
3907 GString *parent = mf_fm_svc_wrapper_get_file_parent_path(path);
3908 SAFE_FREE_GSTRING(path);
3909 __mf_callback_dir_pipe_get_parent(parent);
3913 static void __mf_callback_dir_pipe_cb(void *data, void *buffer, unsigned int nbyte)
3916 struct appdata *ap = (struct appdata *)data;
3917 mf_retm_if(ap == NULL, "appdata is NULL");
3919 if (ap->mf_Status.more != MORE_DEFAULT)
3921 if (ap->mf_Status.view_type == mf_view_root || ap->mf_Status.view_type == mf_view_root_category) {
3924 if (g_strcmp0(ap->mf_Status.monitor_path, ap->mf_Status.path->str)) {
3928 mf_dir_event_t *msg = (mf_dir_event_t *) buffer;
3929 mf_debug("event : %d, name : %s", msg->event, msg->name);
3931 int iIsNoContent = 0;
3932 Evas_Object *newContent = NULL;
3934 iIsNoContent = ap->mf_Status.flagNoContent;
3935 mfItemData_s *itemData = NULL;
3936 Elm_Object_Item *it = NULL;
3937 GString *parent = NULL;
3938 GString *current = NULL;
3939 Evas_Object *parent_obj = NULL;
3943 switch (msg->event) {
3944 case MF_INOTI_CREATE:
3945 case MF_INOTI_MOVE_IN:
3947 path = g_strconcat(ap->mf_Status.path->str, "/", msg->name, NULL);
3949 if (mf_file_attr_is_dir(path)) {
3950 file_type = FILE_TYPE_DIR;
3952 file_type = FILE_TYPE_FILE;
3954 fsNodeInfo *pNode = mf_util_generate_pnode(path, file_type);
3955 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
3956 if (ap->mf_MainWindow.pNaviGenlist == NULL) {
3957 ap->mf_MainWindow.pNaviGenlist = mf_widget_create_genlist(ap->mf_MainWindow.pNaviBar);
3958 evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGenlist, "drag,start,right", mf_genlist_gl_mode_sweep_set, ap);
3959 evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGenlist, "drag,start,left", mf_genlist_gl_mode_sweep_unset, ap);
3960 evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGenlist, "drag,start,up", mf_genlist_gl_mode_cancel, ap);
3961 evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGenlist, "drag,start,down", mf_genlist_gl_mode_cancel, ap);
3962 evas_object_smart_callback_add(ap->mf_MainWindow.pNaviGenlist, "selected", mf_genlist_gl_selected, ap);
3964 evas_object_del(elm_object_part_content_unset(ap->mf_MainWindow.pNaviLayout, "content"));
3965 elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "content", ap->mf_MainWindow.pNaviGenlist);
3967 parent_obj = ap->mf_MainWindow.pNaviGenlist;
3969 if (ap->mf_MainWindow.pNaviGengrid == NULL) {
3970 ap->mf_MainWindow.pNaviGengrid = mf_gengrid_create_grid(ap->mf_MainWindow.pNaviBar);
3971 evas_object_del(elm_object_part_content_unset(ap->mf_MainWindow.pNaviLayout, "content"));
3972 elm_object_part_content_set(ap->mf_MainWindow.pNaviLayout, "content", ap->mf_MainWindow.pNaviGengrid);
3974 parent_obj = ap->mf_MainWindow.pNaviGengrid;
3976 mf_widget_item_append(parent_obj, pNode, ap);
3978 if (pNode != NULL) {
3979 SAFE_FREE_CHAR(pNode->path);
3980 SAFE_FREE_CHAR(pNode->name);
3981 SAFE_FREE_CHAR(pNode->ext);
3986 /*1 TODO: add new item to list */
3987 if (ap->mf_Status.more == MORE_DEFAULT && iIsNoContent) {
3988 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, false);
3989 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_NOCONTENT_VIEW, false);
3992 case MF_INOTI_DELETE:
3993 case MF_INOTI_MOVE_OUT:
3994 path = g_strconcat(ap->mf_Status.path->str, "/", msg->name, NULL);
3995 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
3996 it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist);
3998 itemData = elm_object_item_data_get(it);
3999 if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) {
4003 if (g_strcmp0(path, itemData->m_ItemName->str) == 0) {
4004 elm_object_item_del(it);
4008 it = elm_genlist_item_next_get(it);
4010 count = elm_genlist_items_count(ap->mf_MainWindow.pNaviGenlist);
4011 ap->mf_Status.flagNoContent = !count;
4014 it = elm_gengrid_first_item_get(ap->mf_MainWindow.pNaviGengrid);
4016 itemData = elm_object_item_data_get(it);
4017 if (itemData->m_ItemName == NULL || itemData->m_ItemName->str == NULL) {
4020 if (g_strcmp0(path, itemData->m_ItemName->str) == 0) {
4021 elm_object_item_del(it);
4025 it = elm_gengrid_item_next_get(it);
4027 count = elm_gengrid_items_count(ap->mf_MainWindow.pNaviGengrid);
4028 ap->mf_Status.flagNoContent = !count;
4031 /*1 TODO: remove item from list */
4032 if (ap->mf_Status.more == MORE_DEFAULT && ap->mf_Status.flagNoContent) {
4033 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, true);
4036 case MF_INOTI_MODIFY:
4037 #ifdef MYFILE_SPLIT_VIEW
4038 //todo: optmize the refresh
4039 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
4040 mf_widget_refresh_view(ap);
4045 newContent = mf_navi_bar_content_create(ap);
4046 Evas_Object *pConformant = mfNaviBarConformGet(ap);
4047 mfNaviBarSetContent(ap, pConformant, newContent);
4049 /*1 TODO: update item in list */
4051 case MF_INOTI_DELETE_SELF:
4052 case MF_INOTI_MOVE_SELF:
4054 current = g_string_new(ap->mf_Status.path->str);
4055 parent = __mf_callback_dir_pipe_get_parent(current);
4057 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
4059 g_string_free(ap->mf_Status.path, TRUE);
4060 ap->mf_Status.path = NULL;
4061 ap->mf_Status.path = parent;
4062 #ifdef MYFILE_USB_OTG
4063 /* if click items under otg root path, it means some disk take into use*/
4064 int storage = mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str);
4065 if (storage == MYFILE_OTG) { /* a usb disk take into use */
4066 char *dev_in_use = mf_otg_get_node_in_use(ap);
4067 if (dev_in_use != NULL)
4068 mf_otg_set_node_using_flag(ap, dev_in_use, FALSE);
4071 if (pNavi_s->pCurrentPath != NULL) {
4072 free(pNavi_s->pCurrentPath);
4073 pNavi_s->pCurrentPath = NULL;
4075 pNavi_s->pCurrentPath = g_strdup(parent->str);
4079 mf_widget_refresh_view(ap);
4083 mf_error("Unknown event");
4090 SAFE_FREE_CHAR(path);
4091 mf_inotify_handle_request_handled_send();
4095 static void __mf_callback_dir_update_cb(mf_inotify_event event, char *name, void *data)
4097 struct appdata *ap = (struct appdata *)data;
4098 mf_retm_if(ap == NULL, "appdata is NULL");
4100 mf_debug("event : %d, name : %s", event, name);
4102 mf_dir_event_t buffer;
4104 buffer.event = event;
4105 buffer.name = strdup(name);
4107 ecore_pipe_write(ap->mf_FileOperation.inotify_pipe, &buffer, sizeof(buffer));
4112 int mf_callback_add_dir_watch(const char *path, void *data)
4114 mf_retvm_if(data == NULL, 0, "data is NULL");
4116 struct appdata *ap = (struct appdata *)data;
4117 SAFE_FREE_CHAR(ap->mf_Status.monitor_path);
4118 ap->mf_Status.monitor_path = g_strdup(path);
4119 return mf_inotify_handle_add_watch(path, __mf_callback_dir_update_cb, data);
4122 int mf_callback_remove_dir_watch(void)
4124 return mf_inotify_handle_rm_watch();
4127 int mf_callback_create_dir_monitor(void *data)
4129 struct appdata *ap = (struct appdata *)data;
4130 mf_retvm_if(ap == NULL, -1, "appdata is NULL");
4132 if (ap->mf_FileOperation.inotify_pipe)
4133 ecore_pipe_del(ap->mf_FileOperation.inotify_pipe);
4135 ap->mf_FileOperation.inotify_pipe = ecore_pipe_add(__mf_callback_dir_pipe_cb, (const void *)ap);
4137 return mf_inotify_handle_init_inotify();
4140 void mf_callback_destory_dir_monitor(void *data)
4142 struct appdata *ap = (struct appdata *)data;
4143 mf_retm_if(ap == NULL, "appdata is NULL");
4145 if (ap->mf_FileOperation.inotify_pipe) {
4146 ecore_pipe_del(ap->mf_FileOperation.inotify_pipe);
4147 ap->mf_FileOperation.inotify_pipe = NULL;
4150 mf_inotify_handle_finalize_inotify();
4155 void mf_callback_backbutton_clicked_cb(void *data, Evas_Object *obj, void *event_info)
4157 mf_retm_if(data == NULL, "data is NULL");
4158 struct appdata *ap = (struct appdata *)data;
4160 if (ap->mf_Status.more == MORE_DEFAULT) {
4161 if (ap->mf_Status.view_type == mf_view_root) {
4162 Evas_Object *win = ap->mf_MainWindow.pWindow;
4164 } else if (ap->mf_Status.view_type == mf_view_root_category) {
4165 ap->mf_Status.view_type = mf_view_root;
4166 mf_widget_refresh_view(ap);
4168 mf_callback_upper_click_cb(ap, NULL, NULL);
4171 mf_callback_cancel_cb(ap, NULL, NULL);
4175 void mf_callback_new_folder_changed_cb(void *data, Evas_Object *obj, void *event_info)
4178 struct appdata *ap = (struct appdata *)data;
4179 mf_retm_if(ap == NULL, "ap is null");
4181 Eina_Bool entry_empty = elm_entry_is_empty(ap->mf_MainWindow.pEntry);
4184 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,hide", "elm");
4186 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,show", "elm");
4191 void mf_callback_imf_changed_cb(void *data, Evas_Object *obj, void *event_info)
4194 struct appdata *ap = (struct appdata *)data;
4195 mf_retm_if(ap == NULL, "ap is null");
4197 const char *entry_data = NULL;
4199 char new_str[MYFILE_FILE_NAME_LEN_MAX] = { '\0', };
4201 entry_data = elm_entry_entry_get(ap->mf_MainWindow.pEntry);
4202 mf_retm_if(entry_data == NULL, "entry_data is null");
4203 name = elm_entry_markup_to_utf8(entry_data);
4204 mf_retm_if(name == NULL, "name is null");
4206 Eina_Bool entry_empty = elm_entry_is_empty(ap->mf_MainWindow.pEntry);
4209 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,hide", "elm");
4211 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,show", "elm");
4214 if (mf_file_attr_is_valid_name(name) != MYFILE_ERR_NONE) {
4215 strncpy(new_str, name, MYFILE_FILE_NAME_LEN_MAX - 1);
4216 if (strlen(name) > 0)
4217 new_str[strlen(name) - 1] = '\0';
4218 elm_entry_entry_set(ap->mf_MainWindow.pEntry, new_str);
4219 elm_entry_cursor_end_set(ap->mf_MainWindow.pEntry);
4220 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_FALSE);
4222 if (ap->mf_MainWindow.pNormalPopup) {
4223 SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
4225 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TEXT, NULL, GET_STR(MF_MSG_RENAME_ILLEGAL_CHAR), NULL, NULL,
4226 NULL, mf_popup_show_vk_cb, ap);
4228 SAFE_FREE_CHAR(name);
4233 void mf_callback_rename_button_callback(void *data, Evas_Object * obj, void *event_info)
4236 mfItemData_s *params = (mfItemData_s *)data;
4237 mf_retm_if(params == NULL, "input data is NULL");
4239 struct appdata *ap = (struct appdata *)params->ap;
4240 mf_retm_if(ap == NULL, "input ap is NULL");
4242 Elm_Object_Item *it = params->item;
4243 mf_retm_if(it == NULL, "input item is NULL");
4245 myfileNaviBar *pNavi_toshow = NULL;
4246 pNavi_toshow = mf_navi_bar_get_in_use(ap);
4247 mf_retm_if(pNavi_toshow == NULL, "get navi in use failed");
4249 if (ap->mf_Status.more == MORE_RENAME) {
4250 mf_callback_rename_save_cb(ap, NULL, NULL);
4252 mf_genlist_sweep_item_recover(ap->mf_MainWindow.pNaviGenlist);
4254 ap->mf_Status.preMore = ap->mf_Status.more;
4255 ap->mf_Status.more = MORE_RENAME;
4256 elm_genlist_item_flip_set(it, EINA_TRUE);
4257 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_NONE);
4258 ap->mf_FileOperation.rename_item = it;
4260 if (ap->mf_Status.preMore == MORE_DEFAULT) {
4262 mf_navi_bar_set_upper_item_disable(ap, true);
4263 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_DEFAULT_ALL, true);
4264 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_DEFAULT_ALL, TRUE);
4266 ap->mf_Status.iCtrlDisableItem = mf_navi_bar_button_get_disable(ap->mf_MainWindow.pNaviItem);
4267 mf_debug("ap->mf_Status.iCtrlDisableItem is [%d]", ap->mf_Status.iCtrlDisableItem);
4268 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_EDIT_ALL, true);
4269 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_EDIT_ALL, TRUE);
4275 void mf_callback_detail_ctx_cb(void *data, Evas_Object * obj, void *event_info)
4277 mf_retm_if(data == NULL, "data is NULL");
4278 mfItemData_s *itemData = (mfItemData_s *)data;
4279 struct appdata* ap = (struct appdata *)itemData->ap;
4280 mf_retm_if(ap == NULL, "ap is NULL");
4282 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4283 mf_launch_load_ug(ap, itemData->m_ItemName->str, MF_LOAD_UG_DETAIL, NULL);
4285 static void __mf_callback_delete_in_idle(void *data, Evas_Object * obj, void *event_info)
4287 struct appdata *ap = (struct appdata *)data;
4289 Evas_Object *btn = (Evas_Object *)obj;
4290 const char *label = elm_object_text_get(btn);
4292 if (g_strcmp0(label, GET_SYS_STR(LABEL_CANCEL)) == 0 ) {
4293 SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
4295 } else if (g_strcmp0(label, GET_SYS_STR(LABEL_DELETE)) == 0 ) {
4296 SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
4298 GList *pSourceList = NULL;
4301 mf_util_merge_eina_list_to_glist(ap->mf_FileRecordList.value_saver, &pSourceList);
4304 count = g_list_length(pSourceList);
4309 mf_callback_init_operation_cancel(ap);
4310 ap->mf_FileOperation.iTotalCount = count;
4311 ap->mf_Status.preMore = ap->mf_Status.more;
4312 ap->mf_Status.more = MORE_IDLE_DELETE;
4313 ap->mf_FileOperation.pSourceList = pSourceList;
4314 ap->mf_FileOperation.iOperationSuccessFlag = TRUE;
4315 mf_delete_items(pSourceList, ap->mf_FileOperation.pCancel, TRUE, ap);
4316 SAFE_FREE_OBJ(ap->mf_MainWindow.pProgressPopup);
4317 ap->mf_MainWindow.pProgressPopup = mf_popup_create_pb_popup(ap, GET_SYS_STR(MF_MSG_DELETING), count, mf_callback_progress_bar_cancel_cb, ap);
4321 void mf_callback_delete_button_cb(void *data, Evas_Object * obj, void *event_info)
4324 mfItemData_s *params = (mfItemData_s *) data;
4325 struct appdata *ap = (struct appdata *)params->ap;
4327 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4329 if (ap->mf_FileRecordList.value_saver != NULL) {
4330 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.value_saver, MYFILE_TYPE_GSTRING);
4331 ap->mf_FileRecordList.value_saver = NULL;
4333 ap->mf_FileRecordList.value_saver = eina_list_append(ap->mf_FileRecordList.value_saver, g_string_new(params->m_ItemName->str));
4334 SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
4335 ap->mf_FileOperation.idle_delete_item = params->item;
4336 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_TITLE_TEXT_TWO_BTN,
4338 GET_SYS_STR(MF_BUTTON_LABEL_DEL),
4339 GET_SYS_STR(LABEL_DELETE), GET_SYS_STR(LABEL_CANCEL),
4340 NULL, __mf_callback_delete_in_idle, ap);
4343 void mf_callback_view_as_cb(void *data, Evas_Object * obj, void *event_info)
4346 mf_retm_if(data == NULL, "data is NULL");
4348 struct appdata *ap = (struct appdata *)data;
4350 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4351 ap->mf_MainWindow.pNormalPopup = mf_popup_create_popup(ap, POPMODE_VIEW_AS_LIST, GET_STR(LABEL_VIEW_AS), NULL, NULL, NULL, NULL, mf_callback_popup_deleted_cb, ap);
4353 void mf_callback_view_style_cb(void *data, Evas_Object * obj, void *event_info)
4356 mf_retm_if(data == NULL, "data is NULL");
4358 struct appdata *ap = (struct appdata *)data;
4360 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4361 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST) {
4362 ap->mf_Status.flagViewType = MF_VIEW_STYLE_THUMBNAIL;
4364 ap->mf_Status.flagViewType = MF_VIEW_STYLE_LIST;
4367 mf_util_set_view_style(ap->mf_Status.flagViewType);
4369 if (ap->mf_Status.flagNoContent != EINA_TRUE) {
4370 mf_widget_refresh_view(ap);
4375 void mf_callback_home_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
4378 mf_retm_if(data == NULL, "data is NULL");
4380 Evas_Object *home_button_ic = (Evas_Object *)data;
4381 elm_image_file_set(home_button_ic, MF_TITLE_ICON_HOME_PRESS, NULL);
4384 void mf_callback_home_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
4387 mf_retm_if(data == NULL, "data is NULL");
4389 Evas_Object *home_button_ic = (Evas_Object *)data;
4390 elm_image_file_set(home_button_ic, MF_TITLE_ICON_HOME, NULL);
4393 void mf_callback_select_all_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
4396 mf_retm_if(data == NULL, "data is NULL");
4398 Evas_Object *select_all_button_ic = (Evas_Object *)data;
4399 elm_image_file_set(select_all_button_ic, MF_TITLE_ICON_SELECT_ALL_PRESS, NULL);
4402 void mf_callback_select_all_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
4405 mf_retm_if(data == NULL, "data is NULL");
4407 Evas_Object *select_all_button_ic = (Evas_Object *)data;
4408 elm_image_file_set(select_all_button_ic, MF_TITLE_ICON_SELECT_ALL, NULL);
4411 void mf_callback_home_button_cb(void *data, Evas_Object * obj, void *event_info)
4414 mf_retm_if(data == NULL, "data is NULL");
4416 struct appdata *ap = (struct appdata *)data;
4417 int storage = MYFILE_PHONE;
4418 myfileNaviBar *pNavi_s = NULL;
4421 pNavi_s = mf_navi_bar_get_in_use(ap);
4422 mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
4424 mf_callback_remove_dir_watch();
4426 if (ap->mf_Status.more == MORE_RENAME) {
4427 mf_callback_destory_rename(ap);
4430 ap->mf_Status.view_type = mf_view_root;
4431 #ifdef MYFILE_SPLIT_VIEW
4433 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
4434 mf_navi_bar_set_panes_navi_to_main(ap);
4438 storage = mf_fm_svc_wrapper_get_location(ap->mf_Status.path->str);
4441 SAFE_FREE_GSTRING(ap->mf_Status.path);
4442 ap->mf_Status.path = g_string_new(PHONE_FOLDER);
4445 SAFE_FREE_GSTRING(ap->mf_Status.path);
4446 ap->mf_Status.path = g_string_new(MEMORY_FOLDER);
4449 SAFE_FREE_GSTRING(ap->mf_Status.path);
4450 ap->mf_Status.path = g_string_new(OTG_FOLDER);
4455 #ifdef MYFILE_USB_OTG
4456 /* if click items under otg root path, it means some disk take into use*/
4457 if (storage == MYFILE_OTG) { /* a usb disk take into use */
4458 char *dev_in_use = mf_otg_get_node_in_use(ap);
4459 if (dev_in_use != NULL)
4460 mf_otg_set_node_using_flag(ap, dev_in_use, FALSE);
4463 SAFE_FREE_CHAR(pNavi_s->pCurrentPath);
4464 pNavi_s->pCurrentPath = g_strdup(ap->mf_Status.path->str);
4466 if (ap->mf_MainWindow.pNaviItem) {
4467 mf_navi_bottom_item_del(&ap->mf_MainWindow.pNaviItem);
4469 mf_widget_refresh_view(ap);
4473 void mf_callback_more_button_cb(void *data, Evas_Object * obj, void *event_info)
4476 mf_retm_if(data == NULL, "data is NULL");
4477 struct appdata *ap = (struct appdata *)data;
4478 ap->mf_Status.navi_item_selected = MF_NAVI_BTN_MORE;
4479 mf_context_popup_create_more(ap, obj);
4483 void mf_callback_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
4485 elm_entry_entry_set(data, "");
4488 void mf_callback_list_by_button_callback(void *data, Evas_Object * obj, void *event_info)
4492 struct appdata *ap = (struct appdata *)data;
4494 Evas_Object *btn = (Evas_Object *)obj;
4495 const char *label = elm_object_text_get(btn);
4496 int iListBySortType = 0;
4498 if (g_strcmp0(label, GET_STR(MF_LABEL_DESCENDING)) == 0 ) {
4499 switch(ap->mf_Status.iSelectedSortType) {
4501 iListBySortType = MYFILE_SORT_BY_NAME_Z2A;
4504 iListBySortType = MYFILE_SORT_BY_DATE_R2O;
4508 iListBySortType = MYFILE_SORT_BY_SIZE_L2S;
4511 iListBySortType = MYFILE_SORT_BY_TYPE_Z2A;
4514 iListBySortType = MYFILE_SORT_BY_DATE_R2O;
4517 } else if(g_strcmp0(label, GET_STR(MF_LABEL_ASCENDING)) == 0 ) {
4518 switch(ap->mf_Status.iSelectedSortType) {
4520 iListBySortType = MYFILE_SORT_BY_NAME_A2Z;
4523 iListBySortType = MYFILE_SORT_BY_DATE_O2R;
4527 iListBySortType = MYFILE_SORT_BY_SIZE_S2L;
4530 iListBySortType = MYFILE_SORT_BY_TYPE_A2Z;
4533 iListBySortType = MYFILE_SORT_BY_DATE_O2R;
4538 mf_util_set_sort_type(iListBySortType);
4539 mf_callback_list_by_response_cb(ap);
4542 void mf_callback_sbeam_cb(void *user_data)
4545 mf_retm_if(user_data == NULL, "user_data is NULL");
4547 struct appdata *ap = (struct appdata *)user_data;
4549 if (ap->mf_FileRecordList.selected_files) {
4550 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.selected_files, MYFILE_TYPE_GSTRING);
4552 ap->mf_FileRecordList.selected_files = mf_util_get_all_selected(ap);
4554 Eina_List *files = NULL;
4556 if (ap->mf_Status.more == MORE_EDIT) {
4557 files = mf_util_get_all_selected(ap);
4560 mf_sbeam_share_files(ap->mf_MainWindow.pWindow, files);
4561 mf_util_free_eina_list_with_data(&files, MYFILE_TYPE_GSTRING);
4565 void mf_callback_extension_cb(void *data, Evas_Object * obj, void *event_info)
4568 mf_retm_if(data == NULL, "user_data is NULL");
4570 struct appdata *ap = (struct appdata *)data;
4572 Evas_Object *playout = ap->mf_MainWindow.pNaviLayout;
4573 mf_retm_if(playout == NULL, "get conformant failed");
4574 Evas_Object *newContent = NULL;
4575 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
4576 const char *label = elm_object_item_text_get(item);
4577 if (g_strcmp0(label, GET_STR(MF_LABEL_SHOW_EXTENSION)) == 0) {
4578 mf_util_set_extension_state(MF_EXTENSION_SHOW);
4579 ap->mf_Status.iExtensionState = MF_EXTENSION_SHOW;
4580 } else if (g_strcmp0(label, GET_STR(MF_LABEL_HIDE_EXTENSION)) == 0) {
4581 mf_util_set_extension_state(MF_EXTENSION_HIDE);
4582 ap->mf_Status.iExtensionState = MF_EXTENSION_HIDE;
4584 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4587 SAFE_FREE_OBJ(ap->mf_MainWindow.pContextPopup);
4588 if (ap->mf_Status.flagNoContent != EINA_TRUE) {
4589 newContent = mf_navi_bar_content_create(ap);
4590 mfNaviBarSetContent(ap, playout, newContent);
4593 ap->mf_Status.more = MORE_DEFAULT;
4596 /******************************
4597 ** Prototype : mf_callback_nofity_show_callback
4599 ** Input : void *data
4608 ** 1.Date : 2010/12/10
4610 ** Modification : Created function
4612 ******************************/
4613 void mf_callback_nofity_show_callback(void *data, Evas *e, Evas_Object *obj, void *event_info)
4615 struct appdata *ap = (struct appdata *)data;
4616 mf_retm_if(ap == NULL, "ap is NULL");
4617 edje_object_signal_emit(_EDJ(ap->mf_MainWindow.pLabelLayout), "elm,state,show,default", "elm");
4621 /******************************
4622 ** Prototype : mf_callback_nofity_hide_callback
4624 ** Input : void *data
4633 ** 1.Date : 2010/12/10
4635 ** Modification : Created function
4637 ******************************/
4638 void mf_callback_nofity_hide_callback(void *data, Evas *e, Evas_Object *obj, void *event_info)
4640 struct appdata *ap = (struct appdata *)data;
4641 mf_retm_if(ap == NULL, "invalid parameter ap is NULL");
4643 edje_object_signal_emit(_EDJ(ap->mf_MainWindow.pLabelLayout), "elm,state,hide,default", "elm");
4647 void mf_callback_operation_timeout_cb(void *data, Evas_Object *obj, void *event_info)
4650 struct appdata *ap = (struct appdata *)data;
4654 evas_object_del(obj);
4655 ap->mf_MainWindow.pLabelLayout = NULL;
4656 ap->mf_MainWindow.pOperationNotify = NULL;
4662 Eina_Bool mf_callback_popup_del_idler_cb(void *data)
4665 mf_retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "data is NULL");
4666 struct appdata *ap = (struct appdata *)data;
4667 SAFE_FREE_OBJ(ap->mf_MainWindow.pNormalPopup);
4668 ap->mf_Status.popup_del_idler = NULL;
4670 return ECORE_CALLBACK_CANCEL;
4673 #ifdef MYFILE_MOTION_FEATURE
4675 void mf_callback_motion_double_tap(Evas_Object *genlist)
4678 mf_retm_if(genlist == NULL, "genlist is NULL");
4679 Elm_Object_Item *item = elm_genlist_first_item_get(genlist);
4680 elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_TOP);
4685 void mf_callback_profile_changed_cb(void *data, Evas_Object * obj, void *event_info)
4688 mf_retm_if(data == NULL, "data is NULL");
4689 struct appdata *ap = (struct appdata *)data;
4690 const char *profile = elm_config_profile_get();
4692 if (!strcmp(profile, "desktop")) {
4693 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", NULL);
4694 elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_HIDE);
4697 Evas_Object *btn = elm_button_add(ap->mf_MainWindow.pNaviBar);
4698 elm_object_style_set(btn, "naviframe/end_btn/default");
4699 evas_object_smart_callback_add(btn, "clicked", mf_callback_backbutton_clicked_cb, ap);
4700 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", btn);
4702 elm_win_indicator_mode_set(ap->mf_MainWindow.pWindow, ELM_WIN_INDICATOR_SHOW);
4706 void mf_callback_share_cb(void *data, Evas_Object * obj, void *event_info)
4709 mf_retm_if(data == NULL, "data is NULL");
4710 struct appdata *ap = (struct appdata *)data;
4715 if (ap->mf_FileRecordList.selected_files) {
4716 mf_util_free_eina_list_with_data(&ap->mf_FileRecordList.selected_files, MYFILE_TYPE_GSTRING);
4718 ap->mf_FileRecordList.selected_files = mf_util_get_all_selected(ap);
4720 file_mode = mf_share_mode_get(ap->mf_FileRecordList.selected_files);
4722 if ((file_mode & SHARE_FILE_MODE_OTHERS) || ((file_mode & SHARE_FILE_MODE_IMAGE) && (file_mode & SHARE_FILE_MODE_VIDEO))) {
4723 share_mode = SHARE_MODE_NORMAL;
4724 } else if (file_mode & SHARE_FILE_MODE_MULTI_IMAGE) {
4725 share_mode = SHARE_MODE_MULTI_IMAGE;
4726 } else if (file_mode & SHARE_FILE_MODE_MULTI_VIDEO) {
4727 share_mode = SHARE_MODE_MULTI_VIDEO;
4728 } else if (file_mode & SHARE_FILE_MODE_IMAGE) {
4729 share_mode = SHARE_MODE_IMAGE;
4730 } else if (file_mode & SHARE_FILE_MODE_VIDEO) {
4731 share_mode = SHARE_MODE_VIDEO;
4733 share_mode = SHARE_MODE_NORMAL;
4735 mf_context_popup_create_share(ap, share_mode, obj);
4738 void mf_callback_thumb_created_cb(media_content_error_e error, const char *path, void *user_data)
4740 mf_retm_if(user_data == NULL, "user_data is NULL");
4741 mf_retm_if(path == NULL, "path is NULL");
4742 mfItemData_s *pListData = (mfItemData_s *)user_data;
4743 mf_retm_if(pListData->item == NULL, "pListData->item is NULL");
4745 if (ecore_file_exists(path)) {
4746 mf_debug("Update item with new thumbnail[%s]", path);
4747 SAFE_FREE_CHAR(pListData->thumb_path);
4748 pListData->thumb_path = g_strdup(path);
4749 if (pListData->ap->mf_Status.flagViewType == MF_VIEW_STYLE_THUMBNAIL) {
4750 elm_gengrid_item_update(pListData->item);
4752 elm_genlist_item_update(pListData->item);
4755 mf_debug("Invalid thumb path!");
4759 bool mf_callback_create_thumbnail(void *data, media_thumbnail_completed_cb callback)
4761 mf_retvm_if(data == NULL, -1, "filter is NULL");
4762 mfItemData_s *pListData = (mfItemData_s *)data;
4766 ret = media_info_create_thumbnail(pListData->media, callback,
4768 if (ret != MEDIA_CONTENT_ERROR_NONE) {
4769 mf_debug("Failed to create thumbnail!");
4776 void mf_callback_entry_button_pressed_cb(void *data, Evas_Object * obj, void *event_info)
4779 mf_retm_if(data == NULL, "data is NULL");
4781 Evas_Object *entry_button_ic = (Evas_Object *)data;
4782 elm_image_file_set(entry_button_ic, MF_ICON_ENTRY_FOLDER_PRESS, NULL);
4785 void mf_callback_entry_button_unpressed_cb(void *data, Evas_Object * obj, void *event_info)
4788 mf_retm_if(data == NULL, "data is NULL");
4790 Evas_Object *entry_button_ic = (Evas_Object *)data;
4791 elm_image_file_set(entry_button_ic, MF_ICON_ENTRY_FOLDER, NULL);
4794 void mf_callback_entry_cb(void *data, Evas_Object * obj, void *event_info)
4796 mf_retm_if(data == NULL, "data is NULL");
4797 mfItemData_s *pItemData = (mfItemData_s *)data;
4799 struct appdata *ap = pItemData->ap;
4801 if (ap->mf_Status.path == NULL || ap->mf_Status.path->str == NULL) {
4805 if (ap->mf_Status.flagNaviPush) {
4806 mf_debug("the transition of the naviframe is not finished");
4810 GString *path = mf_fm_svc_wrapper_get_file_parent_path(pItemData->m_ItemName);
4811 mf_retm_if(path == NULL, "path is NULL");
4812 mf_retm_if(path->str == NULL, "path->str is NULL");
4816 bool result = FALSE;
4818 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
4819 mf_retm_if(pNavi_s == NULL, "get navi structure failed");
4821 error_code = mf_util_is_mmc_on(&mmc_card);
4822 if (ap->mf_Status.more == MORE_DEFAULT
4823 || ap->mf_Status.more == MORE_INTERNAL_COPY
4824 || ap->mf_Status.more == MORE_INTERNAL_MOVE
4825 || ap->mf_Status.more == MORE_INTERNAL_COPY_MOVE) {
4826 if (mf_fm_svc_wrapper_is_dir(path)) {
4828 #ifdef MYFILE_USB_OTG
4829 /* if click items under otg root path, it means some disk take into use*/
4831 error_code = mf_file_attr_is_disk_link(path->str, &result);
4832 if (error_code == 0 && result == TRUE) { /* a usb disk take into use */
4834 **we don't need to set the previous device flag to be false
4835 **because click cannot jump from one device to another
4837 mf_otg_set_node_using_flag(ap, path->str,TRUE);
4841 if (ap->mf_Status.path != NULL) {
4842 g_string_free(ap->mf_Status.path, TRUE);
4843 ap->mf_Status.path = NULL;
4845 ap->mf_Status.path = path;
4847 if (pNavi_s->pCurrentPath != NULL) {
4848 free(pNavi_s->pCurrentPath);
4849 pNavi_s->pCurrentPath = NULL;
4851 pNavi_s->pCurrentPath = g_strdup(path->str);
4852 ap->mf_Status.view_type = mf_view_normal;
4853 mf_widget_refresh_view(ap);
4858 void mf_callback_imf_preedit_change_cb(void *data, Evas_Object *obj, void *event_info)
4860 mf_retm_if(data == NULL, "data is NULL");
4861 struct appdata *ap = (struct appdata *)data;
4863 Eina_Bool entry_empty = elm_entry_is_empty(ap->mf_MainWindow.pEntry);
4866 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,hide", "elm");
4868 elm_object_signal_emit(ap->mf_MainWindow.pEditField, "elm,state,eraser,show", "elm");
4873 SAFE_FREE(view_data->editing_text);
4874 const char *preedit_str = elm_entry_entry_get(obj);
4875 view_data->editing_text = g_strdup(preedit_str);
4878 void mf_callback_imf_hide_cb(void *data, Evas_Object *obj, void *event_info)
4880 Evas_Object *entry = (Evas_Object *)data;
4881 elm_object_focus_set(entry, EINA_FALSE);
4884 void mf_callback_naviframe_title_clicked_cb(void *data, Evas_Object *obj, void *event_info)
4886 Elm_Object_Item *navi_it = event_info;
4887 if (!navi_it) return;
4890 Evas_Object *label = elm_object_item_part_content_get(navi_it, "elm.swallow.title");
4893 elm_label_slide_go(label);