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.
18 #include "mf-widget.h"
19 #include "mf-callback.h"
20 #include "mf-fm-svc-wrapper.h"
21 #include "mf-gengrid.h"
24 #include "mf-resource.h"
25 #include "mf-language-mgr.h"
26 #include "mf-tray-item.h"
28 void __mf_navi_bar_reset_navi_obj(void *data)
30 struct appdata *ap = (struct appdata *)data;
31 mf_retm_if(ap == NULL, "ap is NULL");
33 ap->mf_MainWindow.pNaviBox = NULL;
34 ap->mf_MainWindow.pNaviInfoBox = NULL;
35 ap->mf_MainWindow.pTrayBox = NULL;
38 Evas_Object *__mf_navi_bar_get_upper_genlist(Evas_Object *parent)
41 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
42 Evas_Object *upper_layout = NULL;
43 Evas_Object *upper_genlist = NULL;
45 upper_layout = mf_navi_bar_get_box_end(parent);
46 mf_retvm_if(upper_layout == NULL, NULL, "upper_layout is NULL");
48 upper_genlist = elm_object_part_content_get(upper_layout, "upper");
49 mf_retvm_if(upper_genlist == NULL, NULL, "upper_genlist is NULL");
54 Evas_Object *mf_navi_bar_create_navi_bar(Evas_Object * parent)
56 Evas_Object *navi_bar;
58 navi_bar = elm_naviframe_add(parent);
59 elm_naviframe_prev_btn_auto_pushed_set(navi_bar, EINA_FALSE);
60 evas_object_show(navi_bar);
64 /* external functions */
65 /******************************
66 ** Prototype : mfNaviBarCreateView
68 ** Input : struct appdata* data
75 ** 1.Date : 2010/12/10
77 ** Modification : Created function
79 ******************************/
80 Evas_Object *mf_navi_bar_create_search_bar(Evas_Object * parent, void *data)
82 struct appdata *ap = (struct appdata *)data;
83 mf_retv_if(ap == NULL, NULL);
84 mf_retv_if(parent == NULL, NULL);
86 Evas_Object *sb = NULL;
87 Evas_Object *en = NULL;
89 sb = elm_layout_add(parent);
91 elm_layout_theme_set(sb, "layout", "searchbar", "cancel_button");
93 Evas_Object *cancel_btn = elm_button_add(sb);
94 elm_object_style_set(cancel_btn, "searchbar/default");
95 elm_object_text_set(cancel_btn, GET_SYS_STR(LABEL_CANCEL));
96 mf_language_mgr_register_object(cancel_btn, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_CANCEL);
97 evas_object_smart_callback_add(cancel_btn, "clicked", mf_callback_cancel_cb, ap);
99 elm_object_part_content_set(sb, "button_cancel", cancel_btn);
100 elm_object_signal_emit(sb, "cancel,show", "");
101 elm_object_signal_emit(sb, "elm,state,eraser,show", "elm");
103 en = elm_entry_add(sb);
104 elm_entry_scrollable_set(en, EINA_TRUE);
105 elm_entry_single_line_set(en, EINA_TRUE);
106 elm_entry_cnp_mode_set(en, ELM_CNP_MODE_PLAINTEXT);
107 elm_object_part_content_set(sb, "elm.swallow.content", en);
108 evas_object_data_set(sb, "entry", en);
110 elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_NORMAL);
112 evas_object_size_hint_weight_set(sb, EVAS_HINT_EXPAND, 0);
113 evas_object_size_hint_align_set(sb, EVAS_HINT_FILL, 0.0);
115 evas_object_smart_callback_add(en, "maxlength,reached", mf_callback_max_len_reached_cb, ap);
116 evas_object_smart_callback_add(en, "changed", mf_callback_imf_changed_cb, ap);
117 evas_object_smart_callback_add(en, "activated", mf_search_bar_search_started_callback, ap);
119 elm_object_signal_callback_add(sb, "elm,eraser,clicked", "elm", mf_callback_eraser_clicked_cb, en);
121 static Elm_Entry_Filter_Limit_Size limit_filter_data;
122 limit_filter_data.max_char_count = 0;
123 limit_filter_data.max_byte_count = MYFILE_FILE_NAME_LEN_MAX;
124 elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data);
126 evas_object_show(sb);
127 elm_object_focus_set(en, EINA_TRUE);
128 ap->mf_MainWindow.pSearchEntry = en;
136 Evas_Object *mf_navi_bar_get_edit_genlist(void *data)
138 struct appdata *ap = (struct appdata *)data;
139 mf_retv_if(ap == NULL, NULL);
140 return ap->mf_MainWindow.pEditView.pGenlist;
143 Evas_Object *mfNaviBarConformGet(void *data)
145 mf_retv_if(data == NULL, NULL);
146 struct appdata *ap = (struct appdata *)data;
147 return ap->mf_MainWindow.pNaviLayout;
150 Evas_Object *mf_navi_bar_get_box_end(Evas_Object * pBox)
153 mf_retvm_if(pBox == NULL, NULL, "pBox is NULL");
154 Eina_List *pBoxChildren = NULL;
155 pBoxChildren = elm_box_children_get(pBox);
156 mf_retvm_if(pBoxChildren == NULL, NULL, "pBoxChildren is NULL");
158 int len = eina_list_count(pBoxChildren);
161 return eina_list_nth(pBoxChildren, len - 1);
167 /******************************
168 ** Prototype : mfNaviBarSetSegment
170 ** Input : struct appdata* data
177 ** 1.Date : 2010/12/10
179 ** Modification : Created function
181 ******************************/
182 void mf_navi_bar_set_ctrl_bar(struct appdata *data)
185 struct appdata *ap = (struct appdata *)data;
186 mf_retm_if(ap == NULL, "ap is NULL");
187 Evas_Object *NaviBar = ap->mf_MainWindow.pNaviBar;
188 mf_retm_if(NaviBar == NULL, "Navi bar is NULL");
189 Evas_Object *pCtrlBar = NULL;
191 pCtrlBar = mf_ctrl_bar_create(ap, NaviBar);
192 mf_retm_if(pCtrlBar == NULL, "mf_ctrl_bar_create failed");
194 ap->mf_MainWindow.pNaviCtrlBar = pCtrlBar;
195 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, CTRL_STYLE_TYPE, pCtrlBar);
197 evas_object_show(pCtrlBar);
202 Evas_Object *mf_navi_bar_content_create(void *data)
205 mf_retvm_if(data == NULL, NULL, "data is NULL");
207 struct appdata *ap = (struct appdata *)data;
208 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
209 mf_retvm_if(pNavi_s == NULL, NULL, "pNavi_s is NULL");
210 mf_retvm_if(ap->mf_Status.path == NULL, NULL, "ap->mf_Status.path is NULL");
211 mf_retvm_if(ap->mf_Status.path->str == NULL, NULL, "ap->mf_Status.path->str is NULL");
213 Evas_Object *pContent = NULL;
214 Eina_List *file_list = NULL;
215 Eina_List *dir_list = NULL;
216 int dir_list_len = 0;
217 int file_list_len = 0;
220 if (ap->mf_Status.view_type == mf_view_root) {
221 if (ap->mf_FileOperation.folder_list) {
222 mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.folder_list), MYFILE_TYPE_FSNODE);
224 if (ap->mf_FileOperation.file_list) {
225 mf_util_free_eina_list_with_data(&(ap->mf_FileOperation.file_list), MYFILE_TYPE_FSNODE);
228 mf_util_generate_root_view_file_list(&(ap->mf_FileOperation.folder_list), ap->mf_Status.iStorageState);
229 ap->mf_Status.flagNoContent = EINA_FALSE;
230 mf_debug("count is [%d]", eina_list_count(ap->mf_FileOperation.folder_list));
231 } else if (ap->mf_Status.view_type == mf_view_root_category) {
232 if (eina_list_count(ap->mf_FileOperation.category_list) > 0) {
233 ap->mf_Status.flagNoContent = EINA_FALSE;
234 mf_util_sort_the_file_list(ap);
236 ap->mf_Status.flagNoContent = EINA_TRUE;
239 MF_TA_ACUM_ITEM_BEGIN(" mf_util_generate_file_list", 0);
240 error_code = mf_util_generate_file_list(ap);
241 MF_TA_ACUM_ITEM_END(" mf_util_generate_file_list", 0);
242 if (error_code != MYFILE_ERR_NONE) {
243 /*Todo: we need to free all the Eina_List*/
246 MF_TA_ACUM_ITEM_BEGIN(" mf_util_sort_the_file_list", 0);
248 /* sort the list by sort_type*/
249 mf_util_sort_the_file_list(ap);
250 MF_TA_ACUM_ITEM_END(" mf_util_sort_the_file_list", 0);
252 MF_TA_ACUM_ITEM_BEGIN(" No content check", 0);
253 file_list = ap->mf_FileOperation.file_list;
254 dir_list = ap->mf_FileOperation.folder_list;
256 dir_list_len = eina_list_count(dir_list);
257 file_list_len = eina_list_count(file_list);
259 if ((dir_list_len + file_list_len) > 0) {
260 ap->mf_Status.flagNoContent = EINA_FALSE;
262 ap->mf_Status.flagNoContent = EINA_TRUE;
264 MF_TA_ACUM_ITEM_END(" No content check", 0);
266 ap->mf_MainWindow.pNaviGenlist = NULL;
267 ap->mf_MainWindow.pNaviGengrid = NULL;
269 if (ap->mf_Status.flagNoContent) {
270 MF_TA_ACUM_ITEM_BEGIN(" No content create", 0);
271 pContent = mf_widget_create_no_content(ap->mf_MainWindow.pNaviBar);
272 MF_TA_ACUM_ITEM_END(" No content create", 0);
274 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_THUMBNAIL) {
275 pContent = mf_gengrid_create_list(ap, ap->mf_MainWindow.pNaviBar);
276 ap->mf_MainWindow.pNaviGengrid = pContent;
278 MF_TA_ACUM_ITEM_BEGIN(" genlist view create", 0);
279 pContent = mf_genlist_create_list(ap, ap->mf_MainWindow.pNaviBar);
280 MF_TA_ACUM_ITEM_END(" genlist view create", 0);
281 ap->mf_MainWindow.pNaviGenlist = pContent;
284 if (ap->mf_Status.more == MORE_DEFAULT) {
285 MF_TA_ACUM_ITEM_BEGIN(" Add dir monitor", 0);
286 mf_callback_add_dir_watch(ap->mf_Status.path->str, ap);
287 MF_TA_ACUM_ITEM_END(" Add dir monitor", 0);
294 /******************************
295 ** Prototype : mfNaviBarSetContent
297 ** Input : Evas_Object *pLayout
298 ** Evas_Object *NaviContent
305 ** 1.Date : 2010/12/10
307 ** Modification : Created function
309 ******************************/
310 static int __mf_navi_bar_reset_content_idler(void *data)
314 struct appdata *ap = (struct appdata *)data;
316 SAFE_FREE_OBJ(ap->mf_Status.old_content);
317 ap->mf_Status.navi_content_idler = NULL;
321 return ECORE_CALLBACK_CANCEL;
324 void mfNaviBarSetContent(void *data, Evas_Object *pLayout, Evas_Object *NaviContent)
326 mf_retm_if(data == NULL, "data is NULL");
327 mf_retm_if(pLayout == NULL, "pConform is NULL");
328 mf_retm_if(NaviContent == NULL, "NaviContent is NULL");
330 struct appdata *ap = (struct appdata *)data;
331 Evas_Object *unUsed = mf_widget_unset_part_content(pLayout, "content");
332 evas_object_hide(unUsed);
333 ap->mf_Status.old_content = unUsed;
334 mf_ecore_idler_del(ap->mf_Status.navi_content_idler);
335 ap->mf_Status.navi_content_idler = ecore_idler_add((Ecore_Task_Cb)__mf_navi_bar_reset_content_idler, ap);
336 /*if bs, use idler here*/
337 elm_object_part_content_set(pLayout, "content", NaviContent);
340 Evas_Object *mf_navi_bar_get_content(Evas_Object *pConform)
342 return elm_object_content_get(pConform);
345 /******************************
346 ** Prototype : mf_navi_bar_set_style
348 ** Input : struct appdata* data
349 ** eNaviBarStyle navi_style
350 ** Evas_Object *NaviContent
357 ** 1.Date : 2010/12/10
359 ** Modification : Created function
361 ******************************/
362 void mf_navi_bar_title_set(void *data)
365 mf_retm_if(data == NULL, "data is NULL");
366 struct appdata *ap = (struct appdata *)data;
367 int more = ap->mf_Status.more;
368 char *path = ap->mf_Status.path->str;
369 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
370 Evas_Object *pNavi = ap->mf_MainWindow.pNaviBar;
372 if (more == MORE_RENAME || more == MORE_CREATE_FOLDER || more == MORE_THUMBNAIL_RENAME) {
375 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
376 if (more != MORE_EDIT && more != MORE_SEARCH) {
377 if (ap->mf_Status.view_type != mf_view_root) {
378 Evas_Object *home_btn = elm_button_add(pNavi);
379 //elm_object_style_set(home_btn, TITLE_BTN_STYLE);
380 elm_object_style_set(home_btn, "naviframe/title_icon");
381 Evas_Object *home_ic = elm_image_add(pNavi);
382 elm_image_file_set(home_ic, MF_TITLE_ICON_HOME, NULL);
383 elm_image_resizable_set(home_ic, EINA_TRUE, EINA_TRUE);
384 elm_object_content_set(home_btn, home_ic);
385 mf_language_mgr_register_object(home_btn, OBJ_TYPE_ELM_OBJECT, NULL, MF_LABEL_HOME);
386 evas_object_smart_callback_add(home_btn, "clicked", mf_callback_home_button_cb, ap);
387 evas_object_smart_callback_add(home_btn, "pressed", mf_callback_home_button_pressed_cb, home_ic);
388 evas_object_smart_callback_add(home_btn, "unpressed", mf_callback_home_button_unpressed_cb, home_ic);
389 evas_object_show(home_btn);
390 elm_object_item_part_content_set(navi_it, TITLE_LEFT_BTN, home_btn);
392 Evas_Object *up_btn = elm_button_add(pNavi);
393 //elm_object_style_set(up_btn, TITLE_BTN_STYLE);
394 elm_object_style_set(up_btn, "naviframe/title_icon");
395 Evas_Object *up_ic = elm_image_add(pNavi);
396 elm_image_file_set(up_ic, MF_TITLE_ICON_UPPER, NULL);
397 elm_image_resizable_set(up_ic, EINA_TRUE, EINA_TRUE);
398 elm_object_content_set(up_btn, up_ic);
399 mf_language_mgr_register_object(up_btn, OBJ_TYPE_ELM_OBJECT, NULL, MF_LABEL_UPPER);
400 evas_object_smart_callback_add(up_btn, "clicked", mf_callback_upper_click_cb, ap);
401 evas_object_smart_callback_add(up_btn, "pressed", mf_callback_upper_button_pressed_cb, up_ic);
402 evas_object_smart_callback_add(up_btn, "unpressed", mf_callback_upper_button_unpressed_cb, up_ic);
403 evas_object_show(up_btn);
404 elm_object_item_part_content_set(navi_it, TITLE_RIGHT_BTN, up_btn);
406 elm_naviframe_item_title_visible_set(navi_it, EINA_TRUE);
410 elm_naviframe_item_title_visible_set(navi_it, EINA_TRUE);
413 Evas_Object *label = elm_label_add(pNavi);
414 // set the label style
415 elm_object_style_set(label, "naviframe_title");
416 // set the label for the title slide mode
417 elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO);
418 elm_label_wrap_width_set(label, 1);
419 elm_label_ellipsis_set(label, EINA_TRUE);
420 // set the label text
421 if (more == MORE_EDIT) {
422 elm_object_text_set(label, GET_SYS_STR(MF_LABEL_EDIT));
424 elm_object_text_set(label, pNavi_s->pNaviTitle);
426 evas_object_show(label);
427 elm_object_item_part_content_set(navi_it, "elm.swallow.title", label);
432 void mf_navi_bar_set_style(void *data, eNaviBarStyle navi_style, Evas_Object *NaviContent)
434 mf_retm_if(data == NULL, "data is NULL");
435 struct appdata *ap = (struct appdata *)data;
437 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
438 Evas_Object *NaviBar = ap->mf_MainWindow.pNaviBar;
439 mf_retm_if(NaviBar == NULL, "Navi bar is NULL");
440 Evas_Object *pConform = ap->mf_MainWindow.pNaviLayout;
441 mf_retm_if(pConform == NULL, "Conformant is NULL");
442 Evas_Object *l_button = ap->mf_MainWindow.pNaviLeftBtn;
443 Elm_Object_Item *navi_it = NULL;
445 char *title = pNavi_s->pNaviTitle;
446 mfNaviBarSetContent(ap, pConform, NaviContent);
448 switch (navi_style) {
449 case NAVI_BAR_DEFAULT: /*when MMC is off, show "myfile" only*/
450 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
451 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
452 navi_it = elm_naviframe_item_push(NaviBar, NULL, NULL, NULL, pConform, MF_NAVI_STYLE_ENABLE);
454 ap->mf_MainWindow.pNaviItem = navi_it;
456 case NAVI_BAR_PATH_WITH_ONE_ACTION:
457 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
458 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
459 navi_it = elm_naviframe_item_push(NaviBar, NULL, l_button, NULL, pConform, MF_NAVI_STYLE_ENABLE);
460 ap->mf_MainWindow.pNaviItem = navi_it;
468 /******************************
469 ** Prototype : __mf_navi_bar_select_count_label_timeout_cb
471 ** Input : void *data
480 ** 1.Date : 2010/12/10
482 ** Modification : Created function
484 ******************************/
488 void mf_navi_bar_set_upper_item_disable(void *data, bool bFlag)
490 struct appdata *ap = (struct appdata *)data;
491 mf_retm_if(ap == NULL, "ap is NULL");
492 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
493 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
495 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
496 Elm_Object_Item *pUpperItem = NULL;
497 Evas_Object *upper_genlist = NULL;
499 upper_genlist = __mf_navi_bar_get_upper_genlist(ap->mf_MainWindow.pNaviInfoBox);
500 pUpperItem = elm_genlist_first_item_get(upper_genlist);
502 mfItemData_s *itemData = elm_object_item_data_get(pUpperItem);
504 if (itemData && itemData->m_ItemName && itemData->m_ItemName->str
505 && g_strcmp0(itemData->m_ItemName->str, ap->mf_Status.upper_folder) == 0) {
506 elm_object_item_disabled_set(pUpperItem, bFlag);
512 Evas_Object *__mf_navi_bar_backbutton_create(Evas_Object *parent, Evas_Object *win)
515 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
516 mf_retvm_if(win == NULL, NULL, "win is NULL");
518 Evas_Object *btn = NULL;
519 btn = elm_button_add(parent);
520 elm_object_style_set(btn, "naviframe/end_btn/default");
521 evas_object_show(btn);
525 Evas_Object *mf_navi_bar_pathinfo_label_create(Evas_Object *parent, char *pathinfo)
528 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
529 mf_retvm_if(pathinfo == NULL, NULL, "pathinfo is NULL");
530 Evas_Object *label = NULL;
532 label = elm_label_add(parent);
533 elm_object_focus_set(label, EINA_FALSE);
534 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
535 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
536 elm_object_text_set(label, pathinfo);
537 evas_object_show(label);
538 SAFE_FREE_CHAR(pathinfo);
543 Evas_Object *__mf_navi_bar_pathinfo_create(Evas_Object *parent, const char *content)
546 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
547 mf_retvm_if(content == NULL, NULL, "content is NULL");
549 Evas_Object *layout = NULL;
551 layout = elm_layout_add(parent);
552 elm_object_focus_set(layout, EINA_FALSE);
553 elm_layout_file_set(layout, EDJ_NAME, GRP_PATH_INFO);
554 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
555 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
557 //elm_object_part_content_set(layout, "info", content);
558 elm_object_part_text_set(layout, "info", content);
559 evas_object_show(layout);
564 void mf_navi_add_back_button(void *data)
567 mf_retm_if(data == NULL, "data is NULL");
569 struct appdata *ap = (struct appdata *)data;
571 Evas_Object *pBackButton = NULL;
573 pBackButton = __mf_navi_bar_backbutton_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pWindow);
575 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", pBackButton);
576 evas_object_smart_callback_add(pBackButton, "clicked", mf_callback_backbutton_clicked_cb, ap);
580 void mf_navi_remove_home_upper_button(void *data)
583 mf_retm_if(data == NULL, "data is NULL");
585 struct appdata *ap = (struct appdata *)data;
587 if (ap->mf_Status.view_type != mf_view_root) {
588 Evas_Object *btn = NULL;
589 btn = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, TITLE_LEFT_BTN);
591 btn = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, TITLE_RIGHT_BTN);
596 Evas_Object *mf_navi_bar_upper_create(Evas_Object *parent)
599 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
601 Evas_Object *upper_genlist = NULL;
602 upper_genlist = elm_genlist_add(parent);
603 mf_retvm_if(upper_genlist == NULL, NULL, "upper_genlist is NULL");
604 elm_object_focus_set(upper_genlist, EINA_FALSE);
605 evas_object_size_hint_weight_set(upper_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
606 evas_object_size_hint_align_set(upper_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
607 elm_scroller_bounce_set(upper_genlist, EINA_FALSE, EINA_FALSE);
608 evas_object_show(upper_genlist);
610 return upper_genlist;
614 void mf_navi_bar_remove_back_button(Elm_Object_Item *pNaviItem)
617 mf_retm_if(pNaviItem == NULL, "pNaviItem is NULL");
618 Evas_Object *back_btn = NULL;
620 back_btn = elm_object_item_part_content_get(pNaviItem, "prev_btn");
621 if (back_btn != NULL) {
622 elm_object_item_part_content_unset(pNaviItem, "prev_btn");
623 evas_object_hide(back_btn);
624 evas_object_del(back_btn);
629 Evas_Object *mf_navi_bar_create_header_box(void *data)
632 mf_retvm_if(data == NULL, NULL, "data is NULL");
634 struct appdata *ap = (struct appdata *)data;
635 Evas_Object *box = NULL;
636 Evas_Object *pathinfo_layout = NULL;
637 char *pathinfo = NULL;
639 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
640 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
641 mf_retvm_if(pNavi_s == NULL, NULL, "pNavi_s is NULL");
643 //box = mf_widget_create_box(ap->mf_MainWindow.pNaviBox);
644 //evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
645 //evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
646 //elm_box_clear(box);
651 pathinfo = mf_fm_svc_path_info_get(ap->mf_Status.path->str);
652 info = mf_fm_svc_path_info_translate(pathinfo, MF_PATH_INFO_MAX_LENGTH_PORTRAIT);
655 //Evas_Object *genlist = mf_genlist_create_path_info(box, info);
656 pathinfo_layout = __mf_navi_bar_pathinfo_create(ap->mf_MainWindow.pNaviBox, info);
657 evas_object_size_hint_weight_set(pathinfo_layout, EVAS_HINT_EXPAND, 0);
658 evas_object_size_hint_align_set(pathinfo_layout, EVAS_HINT_FILL, 0.0);
659 //evas_object_show(genlist);
662 upper_layout = elm_layout_add(box);
663 elm_object_focus_set(upper_layout, EINA_FALSE);
664 ret = elm_layout_file_set(upper_layout, EDJ_NAME, "upper_folder");
665 evas_object_size_hint_weight_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);//(upper_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
666 evas_object_size_hint_align_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
667 evas_object_show(upper_layout);
668 elm_box_pack_end(box, upper_layout);
671 //elm_box_pack_start(box, pathinfo_layout);
672 evas_object_show(pathinfo_layout);
675 return pathinfo_layout;
678 void mf_navi_bar_set_ctrl_button(void *data)
681 mf_retm_if(data == NULL, "data is NULL");
682 struct appdata *ap = (struct appdata *)data;
683 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
684 Evas_Object *more_bt = NULL;
685 Evas_Object *bt_1 = NULL;
686 Evas_Object *bt_2 = NULL;
687 switch(ap->mf_Status.more) {
689 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
690 if (ap->mf_Status.view_type == mf_view_root) {
691 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, MF_LABEL_SEARCH, NULL, mf_search_bar_enter_search_routine, ap);
693 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, MF_LABEL_EDIT, NULL, mf_callback_edit_cb, ap);
697 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
698 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_DELETE, NULL, mf_callback_delete_cb, ap);
699 bt_2 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_SHARE, NULL, mf_callback_share_cb, ap);
701 case MORE_INTERNAL_COPY:
702 case MORE_DATA_COPYING:
703 if (ap->mf_Status.view_type != mf_view_root) {
704 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
706 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_COPY_HERE, NULL, mf_callback_paste_here_cb, ap);
708 case MORE_INTERNAL_MOVE:
709 case MORE_DATA_MOVING:
710 if (ap->mf_Status.view_type != mf_view_root) {
711 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
713 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_MOVE_HERE, NULL, mf_callback_move_here_cb, ap);
719 elm_object_item_part_content_set(navi_it, NAVI_MORE_BUTTON_PART, more_bt);
722 elm_object_item_part_content_set(navi_it, NAVI_BOTTOM_BUTTON_1_PART, bt_1);
725 elm_object_item_part_content_set(navi_it, NAVI_BOTTOM_BUTTON_2_PART, bt_2);
729 void mf_navi_bar_reset_ctrl_button(void *data)
732 mf_retm_if(data == NULL, "data is NULL");
733 struct appdata *ap = (struct appdata *)data;
734 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
735 mf_retm_if(navi_it == NULL, "navi_it is NULL");
737 Evas_Object *more_bt = NULL;
738 Evas_Object *bt_1 = NULL;
739 Evas_Object *bt_2 = NULL;
740 more_bt = elm_object_item_part_content_unset(navi_it, NAVI_MORE_BUTTON_PART);
741 SAFE_FREE_OBJ(more_bt);
742 bt_1 = elm_object_item_part_content_unset(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
744 bt_2 = elm_object_item_part_content_unset(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
746 mf_navi_bar_set_ctrl_button(ap);
748 void mf_navi_bar_create_default_view(void *data)
751 struct appdata *ap = (struct appdata *)data;
753 GString *title = NULL;
754 Evas_Object *newContent = NULL;
755 Evas_Object *box = NULL;
756 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
757 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
758 mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL");
760 __mf_navi_bar_reset_navi_obj(ap);
762 MF_TA_ACUM_ITEM_BEGIN(" create view box", 0);
763 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
764 MF_TA_ACUM_ITEM_END(" create view box", 0);
766 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
768 MF_TA_ACUM_ITEM_BEGIN(" create genlist", 0);
769 newContent = mf_navi_bar_content_create(ap);
770 MF_TA_ACUM_ITEM_END(" create genlist", 0);
771 /*set title segment or title*/
772 evas_object_show(newContent);
773 MF_TA_ACUM_ITEM_BEGIN(" set title", 0);
774 if (ap->mf_Status.view_type == mf_view_root) {
775 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
776 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
777 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
779 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
781 MF_TA_ACUM_ITEM_END(" set title", 0);
783 MF_TA_ACUM_ITEM_BEGIN(" set content of conform", 0);
786 pNavi_s->pNaviTitle = g_strdup(title->str);
787 g_string_free(title, TRUE);
791 /*navigation view integration*/
792 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newContent);
793 MF_TA_ACUM_ITEM_END(" set content of conform", 0);
795 MF_TA_ACUM_ITEM_BEGIN(" set conform to box", 0);
796 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviLayout);
797 MF_TA_ACUM_ITEM_END(" set conform to box", 0);
799 MF_TA_ACUM_ITEM_BEGIN(" create header box", 0);
800 if (ap->mf_Status.view_type == mf_view_normal) {
801 box = mf_navi_bar_create_header_box(ap);
803 ap->mf_MainWindow.pNaviInfoBox = box;
804 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, box);
807 MF_TA_ACUM_ITEM_END(" create header box", 0);
809 MF_TA_ACUM_ITEM_BEGIN(" push view to navibar", 0);
811 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
813 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
814 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, MF_NAVI_STYLE_ENABLE);
816 MF_TA_ACUM_ITEM_END(" push view to navibar", 0);
818 MF_TA_ACUM_ITEM_BEGIN(" add backbutton", 0);
819 if (ap->mf_Status.more != MORE_INTERNAL_COPY && ap->mf_Status.more != MORE_INTERNAL_MOVE) {
820 mf_navi_add_back_button(ap);
822 MF_TA_ACUM_ITEM_END(" add backbutton", 0);
824 /*add control bar for navigation bar*/
825 MF_TA_ACUM_ITEM_BEGIN(" add control bar", 0);
826 //mf_navi_bar_set_ctrl_bar(ap);
828 mf_navi_bar_set_ctrl_button(data);
829 MF_TA_ACUM_ITEM_END(" add control bar", 0);
831 MF_TA_ACUM_ITEM_BEGIN(" set control bar", 0);
832 if (ap->mf_Status.flagNoContent == 1) {
833 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, true);
834 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_NOCONTENT_VIEW, TRUE);
836 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, FALSE);
837 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_NOCONTENT_VIEW, FALSE);
839 #ifdef MYFILE_USB_OTG
840 if(mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
841 ap->mf_Otg.rootpath_box = ap->mf_MainWindow.pNaviBox;
842 ap->mf_Otg.rootpath_layout = ap->mf_MainWindow.pNaviLayout;
843 ap->mf_Otg.rootpath_navi_item = ap->mf_MainWindow.pNaviItem;
844 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
845 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_OTG_ROOT, TRUE);
848 MF_TA_ACUM_ITEM_END(" set control bar", 0);
849 mf_navi_bar_title_set(ap);
854 /******************************
855 ** Prototype : mf_navi_bar_create_edit_view
857 ** Input : void *data
864 ** 1.Date : 2010/12/10
866 ** Modification : Created function
868 ******************************/
869 void mf_navi_bar_remove_path_info(void *data)
872 struct appdata *ap = (struct appdata *)data;
873 mf_retm_if(ap == NULL, "ap is NULL");
875 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
876 elm_box_unpack(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviPathInfo);
877 evas_object_hide(ap->mf_MainWindow.pNaviPathInfo);
878 //evas_object_del(pNavi_s->pNaviPathInfo);
879 ap->mf_MainWindow.pEditView.pPathInfo = ap->mf_MainWindow.pNaviPathInfo;
881 ap->mf_MainWindow.pEditView.pPathInfo = NULL;
886 void mf_navi_bar_recover_path_info(void *data, myfileNaviBar *pNavi_s)
889 struct appdata *ap = (struct appdata *)data;
890 mf_retm_if(ap == NULL, "ap is NULL");
892 if (ap->mf_MainWindow.pEditView.pPathInfo) {
893 ap->mf_MainWindow.pNaviPathInfo = ap->mf_MainWindow.pEditView.pPathInfo;
894 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviPathInfo);
895 evas_object_show(ap->mf_MainWindow.pEditView.pPathInfo);
902 void mf_navi_bar_remove_info_box(void *data)
905 struct appdata *ap = (struct appdata *)data;
906 mf_retm_if(ap == NULL, "ap is NULL");
908 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
909 elm_box_unpack(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviInfoBox);
910 evas_object_hide(ap->mf_MainWindow.pNaviInfoBox);
911 ap->mf_MainWindow.pEditView.pInfoBox = ap->mf_MainWindow.pNaviInfoBox;
913 ap->mf_MainWindow.pEditView.pInfoBox = NULL;
918 void mf_navi_bar_recover_info_box(void *data, myfileNaviBar *pNavi_s)
921 struct appdata *ap = (struct appdata *)data;
922 mf_retm_if(ap == NULL, "ap is NULL");
924 if (ap->mf_MainWindow.pEditView.pInfoBox) {
925 ap->mf_MainWindow.pNaviInfoBox = ap->mf_MainWindow.pEditView.pInfoBox;
926 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviInfoBox);
927 evas_object_show(ap->mf_MainWindow.pEditView.pInfoBox);
934 void mf_navi_bar_edit_list_update(void *data)
937 mf_retm_if(data == NULL, "data is NULL");
939 struct appdata *ap = (struct appdata *)data;
941 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
942 if (ap->mf_MainWindow.pNaviGenlist) {
943 mf_genlist_sweep_item_recover(ap->mf_MainWindow.pNaviGenlist);
944 mf_genlist_update_edit_view_item_style(ap);
945 ap->mf_MainWindow.pEditView.pGenlist = ap->mf_MainWindow.pNaviGenlist;
946 elm_genlist_decorate_mode_set(ap->mf_MainWindow.pNaviGenlist, EINA_TRUE);
949 Eina_List *file_list = NULL;
950 Eina_List *dir_list = NULL;
952 if (ap->mf_Status.view_type == mf_view_root_category) {
953 file_list = ap->mf_FileOperation.category_list;
955 file_list = ap->mf_FileOperation.file_list;
956 dir_list = ap->mf_FileOperation.folder_list;
959 if (ap->mf_MainWindow.pNaviGengrid) {
960 elm_gengrid_clear(ap->mf_MainWindow.pNaviGengrid);
961 mf_gengrid_create_list_default_style(ap->mf_MainWindow.pNaviGengrid, ap, dir_list, file_list);
962 ap->mf_MainWindow.pEditView.pGengrid = ap->mf_MainWindow.pNaviGengrid;
968 void mf_navi_bar_create_edit_view(void *data)
971 struct appdata *ap = (struct appdata *)data;
972 mf_retm_if(ap == NULL, "ap is NULL");
974 //Evas_Object *pSelectAllLayout = NULL;
975 /*get navigation bar to create view*/
976 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
977 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
979 ap->mf_MainWindow.pEditView.pBox = ap->mf_MainWindow.pNaviBox;
981 mf_navi_bar_remove_info_box(ap);
982 /*create conformant*/
983 mf_navi_remove_home_upper_button(ap);
985 Evas_Object *select_all_btn = elm_button_add(ap->mf_MainWindow.pNaviBar);
986 elm_object_style_set(select_all_btn, "naviframe/title_icon");
987 Evas_Object *select_all_ic = elm_image_add(ap->mf_MainWindow.pNaviBar);
988 elm_image_file_set(select_all_ic, MF_TITLE_ICON_SELECT_ALL, NULL);
989 elm_image_resizable_set(select_all_ic, EINA_TRUE, EINA_TRUE);
990 elm_object_content_set(select_all_btn, select_all_ic);
991 evas_object_smart_callback_add(select_all_btn, "clicked", (Evas_Smart_Cb)__mf_genlist_select_all_layout_mouse_down_cb, ap);
992 evas_object_smart_callback_add(select_all_btn, "pressed", (Evas_Smart_Cb)mf_callback_select_all_button_pressed_cb, select_all_ic);
993 evas_object_smart_callback_add(select_all_btn, "unpressed", (Evas_Smart_Cb)mf_callback_select_all_button_unpressed_cb, select_all_ic);
994 evas_object_show(select_all_btn);
995 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, TITLE_RIGHT_BTN, select_all_btn);
997 mf_navi_bar_title_set(ap);
998 mf_navi_bar_reset_ctrl_button(ap);
1001 if (ap->mf_Status.flagViewType != MF_VIEW_STYLE_THUMBNAIL) {
1002 Elm_Object_Item *it;
1003 it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist);
1005 elm_genlist_item_fields_update(it, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1006 it = elm_genlist_item_next_get(it);
1011 //mf_ctrl_bar_reset(ap);
1012 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_EDIT_ALL, TRUE);
1013 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_EDIT_ALL, true);
1014 /** Todo: should we add segment status set here?*/
1019 /******************************
1020 ** Prototype : mf_navi_bar_create_path_select_view
1022 ** Input : void *data
1029 ** 1.Date : 2010/12/10
1031 ** Modification : Created function
1033 ******************************/
1034 void mf_navi_bar_create_path_select_view(void *data)
1037 struct appdata *ap = (struct appdata *)data;
1038 GString *title = NULL;
1039 Evas_Object *newContent = NULL;
1040 Evas_Object *box = NULL;
1041 /*get navigation bar to create view*/
1042 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1043 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1046 pNavi_s->pre_more = ap->mf_Status.more;
1047 /*create conformant*/
1049 __mf_navi_bar_reset_navi_obj(ap);
1051 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1052 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
1054 newContent = mf_navi_bar_content_create(ap);
1056 /*set title segment or title*/
1057 if (ap->mf_Status.view_type == mf_view_root) {
1058 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1059 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
1060 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1062 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
1065 if (title != NULL) {
1067 pNavi_s->pNaviTitle = g_strdup(title->str);
1068 g_string_free(title, TRUE);
1071 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newContent);
1072 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviLayout);
1073 if (ap->mf_Status.view_type == mf_view_normal) {
1074 box = mf_navi_bar_create_header_box(ap);
1076 ap->mf_MainWindow.pNaviInfoBox = box;
1077 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, box);
1080 /*Navigation bar Path Select view integration*/
1082 MF_TA_ACUM_ITEM_BEGIN(" push view to navibar", 0);
1083 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1085 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1086 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, MF_NAVI_STYLE_ENABLE);
1087 MF_TA_ACUM_ITEM_END(" push view to navibar", 0);
1089 mf_navi_add_back_button(ap);
1091 /*add control bar for navigation bar*/
1092 //mf_navi_bar_set_ctrl_bar(ap);
1093 mf_navi_bar_set_ctrl_button(data);
1094 #ifdef MYFILE_USB_OTG
1095 /*control bar disable set if in otg root path*/
1096 if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
1097 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_OPT_ROOT, TRUE);
1100 if (ap->mf_Status.view_type == mf_view_root || ap->mf_Status.view_type == mf_view_root_category) {
1101 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
1103 mf_navi_bar_title_set(ap);
1106 /** Todo: should we add segment status set here?*/
1110 void mf_navi_bar_create_path_select_view_otg_root(void *data)
1113 struct appdata *ap = (struct appdata *)data;
1114 GString *title = NULL;
1115 Evas_Object *newContent = NULL;
1117 /*get navigation bar to create view*/
1118 myfileNaviBar *pNavi_s = mf_navi_bar_get_struct_by_label(ap, GET_STR(MF_LABEL_OTG));
1119 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1122 pNavi_s->pre_more = ap->mf_Status.more;
1123 /*create conformant*/
1124 __mf_navi_bar_reset_navi_obj(ap);
1126 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBar, EDJ_NAME, "selectinfo_layout");
1128 ap->mf_MainWindow.pNaviBox = ap->mf_MainWindow.pNaviLayout;
1130 newContent = mf_navi_bar_content_create(ap);
1132 /*set title segment or title*/
1133 if (ap->mf_Status.view_type == mf_view_root) {
1134 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1135 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
1136 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1138 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
1141 if (title != NULL) {
1143 pNavi_s->pNaviTitle = g_strdup(title->str);
1144 g_string_free(title, TRUE);
1147 /*Navigation bar Path Select view integration*/
1148 mf_navi_bar_set_style(ap, NAVI_BAR_PATH_WITH_ONE_ACTION, newContent);
1149 /*add control bar for navigation bar*/
1150 //mf_navi_bar_set_ctrl_bar(ap);
1151 mf_navi_add_back_button(ap);
1152 mf_navi_bar_set_ctrl_button(data);
1153 mf_navi_bar_title_set(ap);
1154 #ifdef MYFILE_USB_OTG
1155 /*control bar disable set if in otg root path*/
1156 if(mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
1157 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
1158 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_OTG_ROOT, TRUE);
1162 /** Todo: should we add segment status set here?*/
1167 /******************************
1168 ** Prototype : mf_navi_bar_create_search_view
1170 ** Input : void *data
1177 ** 1.Date : 2010/12/10
1179 ** Modification : Created function
1181 ******************************/
1182 #ifdef MYFILE_SPLIT_VIEW
1183 void mf_navi_bar_set_panes_navi_to_main(void *data)
1186 mf_retm_if(data == NULL, "data is NULL");
1187 struct appdata *ap = (struct appdata*)data;
1188 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1190 mf_widget_unset_main_layout_content(ap->mf_MainWindow.sSplitData.pMainLayout);
1191 /***1. unset naviframe from panes/right layout **/
1192 mf_split_view_unset_right_content(ap);
1193 /***2. unset panes from main layout **/
1194 mf_widget_unset_main_layout_content(ap->mf_MainWindow.pMainLayout);
1197 /***3. set naviframe to main layout **/
1198 elm_object_part_content_set(ap->mf_MainWindow.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.pNaviBar);
1203 void mf_navi_bar_reset_panes_main(void *data)
1206 mf_retm_if(data == NULL, "data is NULL");
1207 struct appdata *ap = (struct appdata*)data;
1210 mf_widget_unset_main_layout_content(ap->mf_MainWindow.pMainLayout);
1211 elm_object_part_content_set(ap->mf_MainWindow.sSplitData.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.pNaviBar);
1213 mf_widget_panes_right_set(ap->mf_MainWindow.sSplitData.pPanes, ap->mf_MainWindow.sSplitData.pMainLayout);
1214 /**** 3. set panes to main layout **/
1215 elm_object_part_content_set(ap->mf_MainWindow.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.sSplitData.pPanes);
1216 mf_split_view_show(ap);
1220 void mf_navi_bar_create_search_view(void *data)
1223 struct appdata *ap = (struct appdata *)data;
1225 GString *title = NULL;
1226 Evas_Object *path_label = NULL;
1227 #ifdef MYFILE_SPLIT_VIEW
1228 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1229 mf_navi_bar_set_panes_navi_to_main(ap);
1233 __mf_navi_bar_reset_navi_obj(ap);
1235 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1236 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1237 Evas_Object *pSearchViewLayout = NULL;
1238 //ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
1239 pSearchViewLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBar, EDJ_NAME, "selectinfo_layout");
1240 ap->mf_MainWindow.pNaviLayout = pSearchViewLayout;
1242 ap->mf_MainWindow.pNaviSearchBar = mf_navi_bar_create_search_bar(pSearchViewLayout, ap);
1243 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1246 /*2. create path label for the start of search view*/
1247 /*2.1 create path label*/
1249 path_label = elm_entry_add(pSearchViewLayout);
1251 elm_object_style_set(path_label, "default");
1252 elm_entry_single_line_set(path_label, EINA_FALSE);
1253 elm_object_focus_set(path_label, EINA_FALSE);
1255 evas_object_show(path_label);
1256 /*2.2 contribute label content*/
1257 char *path_in_label = mf_fm_svc_wrapper_translate_path(ap->mf_Status.path->str, MF_TRANS_OPTION_LABEL);
1258 char *label_content = g_strconcat(GET_SYS_STR(MF_LABEL_SEARCH), ":", "<br>", path_in_label, NULL);
1259 /*2.3 set style for path_label*/
1260 elm_entry_editable_set(path_label, EINA_FALSE);
1261 elm_entry_entry_set(path_label, label_content);
1263 /*set title segment or title*/
1264 title = g_string_new(GET_SYS_STR(MF_LABEL_SEARCH));
1265 if (title != NULL) {
1266 pNavi_s->pNaviTitle = g_strdup(title->str);
1267 g_string_free(title, TRUE);
1270 /*navigation view integration*/
1271 elm_object_part_content_set(pSearchViewLayout, "content", path_label);
1272 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, pSearchViewLayout);
1273 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviSearchBar);
1276 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1278 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1279 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, MF_NAVI_STYLE_ENABLE);
1282 /*hide Tab Bar in search view*/
1284 /*add control bar for navigation bar*/
1286 if (path_in_label != NULL) {
1287 free(path_in_label);
1288 path_in_label = NULL;
1290 if (label_content != NULL) {
1291 free(label_content);
1292 label_content = NULL;
1294 mf_navi_bar_title_set(ap);
1295 evas_object_show(ap->mf_MainWindow.pSearchEntry);
1296 elm_object_focus_set(ap->mf_MainWindow.pSearchEntry, EINA_TRUE);
1297 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
1302 static void __new_folder_entryfield_create(Evas_Object *parent, void *data)
1305 struct appdata *ap = (struct appdata *)data;
1306 mf_retm_if(ap == NULL, "ap is NULL");
1307 mf_retm_if(parent == NULL, "parent is NULL");
1309 char *fileName = NULL;
1310 GString *dest_fullpath;
1311 static Elm_Entry_Filter_Limit_Size limit_filter;
1312 Evas_Object *entry = NULL;
1313 Evas_Object *edit_field = NULL;
1314 char *fullpath = (char *)malloc(sizeof(char) * MYFILE_FILE_PATH_LEN_MAX);
1315 if (fullpath == NULL) {
1319 mf_widget_create_entryfield(ap, parent, mf_callback_new_folder_changed_cb, NULL);
1320 entry = ap->mf_MainWindow.pEntry;
1322 edit_field = ap->mf_MainWindow.pEditField;
1324 limit_filter.max_char_count = MYFILE_FILE_NAME_LEN_MAX;
1325 limit_filter.max_byte_count = 0;
1327 memset(fullpath, 0, MYFILE_FILE_PATH_LEN_MAX);
1328 fileName = elm_entry_markup_to_utf8(GET_SYS_STR(MF_LABEL_FOLDER));
1329 snprintf(fullpath, (MYFILE_FILE_PATH_LEN_MAX), "%s/%s", (char *)ap->mf_Status.path->str, fileName);
1331 dest_fullpath = g_string_new(fullpath);
1333 elm_entry_markup_filter_append(ap->mf_MainWindow.pEntry, elm_entry_filter_limit_size, &limit_filter);
1334 evas_object_smart_callback_add(ap->mf_MainWindow.pEntry, "maxlength,reached", mf_callback_max_len_reached_cb, ap);
1335 evas_object_smart_callback_add(ap->mf_MainWindow.pEntry, "preedit,changed",
1336 mf_callback_imf_preedit_change_cb, ap);
1338 if (mf_fm_svc_wrapper_detect_duplication(dest_fullpath)) {
1339 mf_debug("dectetion result is TRUE\ndest_fullpath is %s\n", dest_fullpath->str);
1340 error_code = mf_fm_svc_wrapper_file_auto_rename(ap, dest_fullpath, FILE_NAME_WITH_BRACKETS, &dest_fullpath);
1341 mf_debug("rename result is %s\n", dest_fullpath->str);
1342 memset(fullpath, 0, strlen(fullpath));
1343 int len = strlen(ap->mf_Status.path->str) + 1;
1344 strncpy(fullpath, dest_fullpath->str + len, MYFILE_FILE_PATH_LEN_MAX);
1345 /*memset(fileName,0,strlen(fileName));*/
1347 SAFE_FREE_CHAR(fileName);
1348 fileName = elm_entry_markup_to_utf8(fullpath);
1351 /*elm_entry_entry_set(entry, ecore_file_file_get(params->m_ItemName->str));*/
1352 mf_widget_imf_hide_callback_register(ap->mf_MainWindow.pConformant, entry);
1354 elm_entry_entry_set(entry, fileName);
1355 elm_entry_cursor_end_set(entry);
1357 SAFE_FREE_CHAR(fullpath);
1358 SAFE_FREE_GSTRING(dest_fullpath);
1359 SAFE_FREE_CHAR(fileName);
1363 void mf_navi_bar_create_new_folder_view(void *data)
1366 struct appdata *ap = (struct appdata *)data;
1367 mf_retm_if(ap == NULL, "ap is NULL");
1369 Evas_Object *newContent = NULL;
1371 Evas_Object *pNaviBar = NULL;
1372 GString *title = NULL;
1373 #ifdef MYFILE_SPLIT_VIEW
1374 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1375 mf_navi_bar_set_panes_navi_to_main(ap);
1379 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1380 mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
1382 __mf_navi_bar_reset_navi_obj(ap);
1384 pNaviBar = ap->mf_MainWindow.pNaviBar;
1385 ap->mf_MainWindow.pNaviBox = NULL;
1386 ap->mf_MainWindow.pNaviLayout= NULL;
1388 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1389 newContent = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, GRP_NEW_FOLDER);
1390 __new_folder_entryfield_create(newContent, ap);
1391 evas_object_size_hint_weight_set(newContent, EVAS_HINT_EXPAND, 0);
1392 evas_object_size_hint_align_set(newContent, EVAS_HINT_FILL, 0.0);
1393 Evas_Object *pad = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "PAD");
1394 elm_object_part_content_set(newContent, "content", ap->mf_MainWindow.pEditField);
1395 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, newContent);
1396 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, pad);
1397 //newContent = mf_genlist_create_list_new_folder_style(ap);
1398 /*set title segment or title*/
1399 /*navigation view integration*/
1401 Elm_Object_Item *navi_it = NULL;
1402 //mf_navi_bar_set_style(ap, NAVI_BAR_DEFAULT, newContent);
1403 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1404 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1405 navi_it = elm_naviframe_item_push(pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, NULL);
1407 ap->mf_MainWindow.pNaviItem = navi_it;
1409 //mf_navi_add_back_button(ap);
1411 Evas_Object *l_bt = NULL;
1412 Evas_Object *r_bt = NULL;
1414 l_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1415 elm_object_focus_set(l_bt, EINA_FALSE);
1416 elm_object_style_set(l_bt, "naviframe/title/default");
1417 elm_object_text_set(l_bt, GET_SYS_STR(LABEL_SAVE));
1418 mf_language_mgr_register_object(l_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_SAVE);
1419 evas_object_smart_callback_add(l_bt, "clicked", mf_callback_save_cb, ap);
1420 evas_object_show(l_bt);
1421 elm_object_item_part_content_set(navi_it, "title_toolbar_button1", l_bt);
1422 //elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, TITLE_LEFT_BTN, l_bt);
1425 r_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1426 elm_object_focus_set(r_bt, EINA_FALSE);
1427 elm_object_style_set(r_bt, "naviframe/end_btn/default");
1428 //elm_object_style_set(r_bt, TITLE_BTN_STYLE);
1429 //elm_object_text_set(r_bt, GET_SYS_STR(LABEL_CANCEL));
1430 //mf_language_mgr_register_object(r_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_CANCEL);
1431 evas_object_smart_callback_add(r_bt, "clicked", mf_callback_cancel_cb, ap);
1432 evas_object_show(r_bt);
1433 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "title_prev_btn", r_bt);
1435 elm_object_item_signal_emit(navi_it, "elm,state,sip,shown", "");
1437 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_TRUE);
1442 static void __rename_entryfield_create(Evas_Object *parent, void *data)
1446 mfItemData_s *params = (mfItemData_s *) data;
1447 mf_retvm_if(params == NULL, NULL, "param is NULL");
1448 mf_retvm_if(params->m_ItemName == NULL, NULL, "m_ItemName is NULL");
1450 struct appdata *ap = (struct appdata *)params->ap;
1451 mf_retvm_if(ap == NULL, NULL, "input parameter data error");
1453 static Elm_Entry_Filter_Limit_Size limit_filter_data;
1454 Evas_Object *edit_field = NULL;
1455 Evas_Object *entry = NULL;
1456 GString *filename = NULL;
1458 mf_widget_create_entryfield(ap, parent, mf_callback_imf_changed_cb, NULL);
1460 entry = ap->mf_MainWindow.pEntry;
1462 edit_field = ap->mf_MainWindow.pEditField;
1464 evas_object_size_hint_weight_set(edit_field, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1465 evas_object_size_hint_align_set(edit_field, EVAS_HINT_FILL, EVAS_HINT_FILL);
1468 elm_entry_single_line_set(entry, EINA_TRUE);
1469 elm_entry_scrollable_set(entry, EINA_TRUE);
1470 elm_object_signal_emit(edit_field, "elm,state,eraser,show", "elm");
1471 //elm_editfield_eraser_set(edit_field, EINA_TRUE);
1473 elm_entry_autocapital_type_set(entry, ELM_AUTOCAPITAL_TYPE_NONE);
1474 elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
1476 if (params->ap->mf_FileOperation.to_rename != NULL) {
1477 g_string_free(params->ap->mf_FileOperation.to_rename, TRUE);
1478 params->ap->mf_FileOperation.to_rename = NULL;
1480 params->ap->mf_FileOperation.to_rename = g_string_new((char *)params->m_ItemName->str);
1483 /* the below is sample code for control entry. It is not mandatory.*/
1485 /* set guide text */
1486 filename = mf_fm_svc_wrapper_get_file_name(ap->mf_FileOperation.to_rename);
1487 char *guide_text = NULL;
1488 SAFE_FREE_CHAR(ap->mf_FileOperation.file_name_suffix);
1489 if (!mf_file_attr_is_dir(ap->mf_FileOperation.to_rename->str)) {
1492 char *name_without_ext = NULL;
1493 name_without_ext = g_strdup(ap->mf_FileOperation.to_rename->str);
1494 mf_file_attr_get_file_ext(ap->mf_FileOperation.to_rename->str, &ext);
1495 mf_debug("ext is %s", ext);
1496 if (ext && strlen(ext) != 0) {
1498 name_without_ext[strlen(name_without_ext) - strlen(ext) - 1] = '\0';
1499 ap->mf_FileOperation.file_name_suffix = strdup(ext);
1500 mf_debug("name_without_ext is [%s]\n", name_without_ext);
1501 if (strlen(name_without_ext)) {
1502 guide_text = elm_entry_utf8_to_markup(ecore_file_file_get(name_without_ext));
1504 guide_text = elm_entry_utf8_to_markup(filename->str);
1507 guide_text = elm_entry_utf8_to_markup(filename->str);
1510 SAFE_FREE_CHAR(ext);
1511 SAFE_FREE_CHAR(name_without_ext);
1513 guide_text = elm_entry_utf8_to_markup(filename->str);
1516 if (ap->mf_FileOperation.file_name_suffix) {
1517 limit_filter_data.max_char_count = (MYFILE_FILE_NAME_LEN_MAX - mf_util_character_count_get(ap->mf_FileOperation.file_name_suffix) - 1);
1519 limit_filter_data.max_char_count = MYFILE_FILE_NAME_LEN_MAX;
1522 limit_filter_data.max_byte_count = 0;
1523 elm_entry_markup_filter_append(ap->mf_MainWindow.pEntry, elm_entry_filter_limit_size, &limit_filter_data);
1524 elm_entry_input_panel_return_key_type_set(ap->mf_MainWindow.pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
1526 elm_entry_entry_set(ap->mf_MainWindow.pEntry, guide_text);
1527 /*elm_entry_entry_set(entry, ecore_file_file_get(params->m_ItemName->str));*/
1528 elm_entry_cursor_end_set(entry);
1530 SAFE_FREE_CHAR(guide_text);
1531 SAFE_FREE_GSTRING(filename);
1533 evas_object_smart_callback_add(entry, "activated", mf_genlist_rename_done, params->ap);
1534 evas_object_smart_callback_add(entry, "maxlength,reached", mf_callback_max_len_reached_cb, params->ap);
1535 evas_object_smart_callback_add(entry, "preedit,changed",
1536 mf_callback_imf_preedit_change_cb, ap);
1537 mf_widget_imf_hide_callback_register(ap->mf_MainWindow.pConformant, entry);
1539 evas_object_show(entry);
1540 elm_object_focus_set(entry, EINA_TRUE);
1546 void mf_navi_bar_create_rename_view(void *data)
1550 mfItemData_s *params = (mfItemData_s *) data;
1552 struct appdata *ap = (struct appdata *)params->ap;
1553 mf_retm_if(ap == NULL, "ap is NULL");
1555 Evas_Object *newContent = NULL;
1557 Evas_Object *pNaviBar = NULL;
1558 GString *title = NULL;
1559 #ifdef MYFILE_SPLIT_VIEW
1560 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1561 mf_navi_bar_set_panes_navi_to_main(ap);
1565 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1566 mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
1568 pNaviBar = ap->mf_MainWindow.pNaviBar;
1569 SAFE_FREE_GSTRING(ap->mf_FileOperation.to_rename);
1571 ap->mf_FileOperation.to_rename = g_string_new((char *)params->m_ItemName->str);
1573 ap->mf_MainWindow.pNaviBox = NULL;
1574 ap->mf_MainWindow.pNaviLayout= NULL;
1576 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1577 newContent = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, GRP_NEW_FOLDER);
1578 __rename_entryfield_create(newContent, params);
1579 evas_object_size_hint_weight_set(newContent, EVAS_HINT_EXPAND, 0);
1580 evas_object_size_hint_align_set(newContent, EVAS_HINT_FILL, 0.0);
1581 Evas_Object *pad = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "PAD");
1582 elm_object_part_content_set(newContent, "content", ap->mf_MainWindow.pEditField);
1583 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, newContent);
1584 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, pad);
1586 title = g_string_new(GET_SYS_STR(LABEL_RENAME));
1588 if (title != NULL) {
1589 pNavi_s->pNaviTitle = g_strdup(title->str);
1590 g_string_free(title, TRUE);
1593 /*navigation view integration*/
1594 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1595 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1596 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, NULL);
1599 Evas_Object *l_bt = NULL;
1600 Evas_Object *r_bt = NULL;
1602 l_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1603 elm_object_focus_set(l_bt, EINA_FALSE);
1604 elm_object_style_set(l_bt, "naviframe/title/default");
1605 elm_object_text_set(l_bt, GET_SYS_STR(LABEL_SAVE));
1606 mf_language_mgr_register_object(l_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_SAVE);
1607 evas_object_smart_callback_add(l_bt, "clicked", mf_callback_save_cb, ap);
1608 evas_object_show(l_bt);
1609 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "title_toolbar_button1", l_bt);
1611 r_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1612 elm_object_focus_set(r_bt, EINA_FALSE);
1613 elm_object_style_set(r_bt, "naviframe/end_btn/default");
1614 evas_object_smart_callback_add(r_bt, "clicked", mf_callback_cancel_cb, ap);
1615 evas_object_show(r_bt);
1616 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "title_prev_btn", r_bt);
1617 elm_object_item_signal_emit(ap->mf_MainWindow.pNaviItem, "elm,state,sip,shown", "");
1622 myfileNaviBar *mf_navi_bar_get_in_use(void *data)
1625 struct appdata *ap = (struct appdata *)data;
1626 mf_retvm_if(ap == NULL, NULL, "ap is NULL");
1627 Eina_List *plistNavi_s = ap->mf_MainWindow.plistNaviBar;
1628 mf_retvm_if(plistNavi_s == NULL, NULL, "plistNavi_s is NULL");
1630 myfileNaviBar *ret = NULL;
1631 Eina_List *l = NULL;
1634 EINA_LIST_FOREACH(plistNavi_s, l, item) {
1635 ret = (myfileNaviBar *) item;
1637 mf_retvm_if(ret == NULL, NULL, "item is NULL");
1639 if (ret->naviFlagInUse == TRUE) {
1649 myfileNaviBar *mf_navi_bar_get_edit_start(void *data)
1651 struct appdata *ap = (struct appdata *)data;
1653 Eina_List *plistNavi_s = ap->mf_MainWindow.plistNaviBar;
1654 assert(plistNavi_s);
1656 myfileNaviBar *ret = NULL;
1657 Eina_List *l = NULL;
1660 EINA_LIST_FOREACH(plistNavi_s, l, item) {
1661 ret = (myfileNaviBar *) item;
1662 if (ret->naviFlagEditStart == TRUE) {
1671 void mf_navi_bar_object_reset(myfileNaviBar *pNavi_s)
1673 mf_retm_if(pNavi_s == NULL, "Navi structure is NULL");
1674 pNavi_s->pNaviTitle = NULL;
1676 if (pNavi_s->pCurrentPath != NULL)
1677 free(pNavi_s->pCurrentPath);
1678 pNavi_s->pCurrentPath = NULL;
1680 if (pNavi_s->pNaviLabel != NULL)
1681 free(pNavi_s->pNaviLabel);
1682 pNavi_s->pNaviLabel = NULL;
1685 /******************************
1686 ** Prototype : mfNaviBarListItemRemove
1687 ** Description : remove the navi bar item from the list by label
1688 ** Input : void *data
1689 ** const char* pNaviLabel
1696 ** 1.Date : 2010/12/10
1698 ** Modification : Created function
1700 ******************************/
1701 bool mf_navi_bar_remove_list_item_by_label(void *data, const char *pNaviLabel)
1703 struct appdata *ap = (struct appdata *)data;
1704 mf_retvm_if(ap == NULL, false, "ap is NULL");
1705 mf_retvm_if(pNaviLabel == NULL, false, "Navi Bar Label is NULL");
1707 bool bEditStartFlag = FALSE;
1708 bool bInUseFlag = FALSE;
1710 myfileNaviBar *pNavi_s = mf_navi_bar_get_struct_by_label(ap, pNaviLabel);
1712 if (pNavi_s == NULL) {
1714 return bEditStartFlag;
1716 Eina_List *plistNavi = eina_list_data_find_list(ap->mf_MainWindow.plistNaviBar, pNavi_s);
1717 ap->mf_MainWindow.plistNaviBar = eina_list_remove_list(ap->mf_MainWindow.plistNaviBar, plistNavi);
1720 if (pNavi_s->naviFlagEditStart == TRUE) {
1721 bEditStartFlag = TRUE;
1723 if (pNavi_s->naviFlagInUse == TRUE) {
1727 mf_navi_bar_object_reset(pNavi_s);
1729 if (bInUseFlag == TRUE) {
1730 pNavi_s = (myfileNaviBar *) eina_list_nth(ap->mf_MainWindow.plistNaviBar, 0);
1731 pNavi_s->naviFlagInUse = TRUE;
1734 return bEditStartFlag;
1737 myfileNaviBar *mf_navi_bar_get_struct_by_label(void *data, const char *pNaviLabel)
1739 struct appdata *ap = (struct appdata *)data;
1740 mf_retvm_if(ap == NULL, NULL, "ap is NULL");
1741 mf_retvm_if(pNaviLabel == NULL, NULL, "Navi Bar Label is NULL");
1743 Eina_List *l = NULL;
1746 myfileNaviBar *ret = NULL;
1747 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
1748 if (g_strcmp0(((myfileNaviBar *) item)->pNaviLabel, pNaviLabel) == 0) {
1749 ret = (myfileNaviBar *) item;
1756 myfileNaviBar *mf_navi_bar_recover_list(void *data)
1759 struct appdata *ap = (struct appdata *)data;
1762 /*0 set state to be Default*/
1763 ap->mf_Status.more = MORE_DEFAULT;
1764 /*1 recover all the navigation bar*/
1765 Eina_List *l = NULL;
1767 myfileNaviBar *pNavi_s = NULL;
1768 myfileNaviBar *pNavi_toshow = NULL;
1769 bool flag_pop_todo = FALSE;
1770 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
1771 flag_pop_todo = TRUE;
1772 pNavi_s = (myfileNaviBar *) item;
1773 /*2.0 recover the pre_status*/
1774 pNavi_s->pre_more = ap->mf_Status.more;
1775 /*2.1 recover the path just before when edit click*/
1776 pNavi_s->pCurrentPath = g_strdup(pNavi_s->pre_operation.path->str);
1777 /*2.2 free the backup data structure*/
1778 g_string_free(pNavi_s->pre_operation.path, TRUE);
1779 pNavi_s->pre_operation.path = NULL;
1780 memset(&(pNavi_s->pre_operation), 0, sizeof(oper_record));
1781 /*2.3 set navi related status*/
1782 if (pNavi_s->naviFlagInUse == TRUE) {
1783 /*2.1-1 set pNavi_toshow for refreshing*/
1784 pNavi_toshow = pNavi_s;
1787 return pNavi_toshow;
1790 void mf_navi_bar_refresh_recovered_view(void *data, myfileNaviBar * pNaviStruct)
1793 struct appdata *ap = (struct appdata *)data;
1794 mf_retm_if(ap == NULL, "ap is NULL");
1795 mf_retm_if(pNaviStruct == NULL, "Navi Bar Struct is NULL");
1797 if (ap->mf_Status.path != NULL) {
1798 g_string_free(ap->mf_Status.path, TRUE);
1799 ap->mf_Status.path = NULL;
1801 ap->mf_Status.path = g_string_new(pNaviStruct->pCurrentPath);
1802 mf_debug("ap->mf_Status.path is [%s]", ap->mf_Status.path->str);
1805 mf_widget_refresh_view(ap);
1810 bool mf_navi_bar_is_navi_empty(void *data, char *label)
1812 struct appdata *ap = (struct appdata *)data;
1817 Elm_Object_Item *top_it= elm_naviframe_top_item_get(ap->mf_MainWindow.pNaviBar);
1818 Evas_Object *top_view = elm_object_item_content_get(top_it);
1820 if (top_view == NULL)
1826 void mf_navi_bar_transition_finished_cb(void *data, Evas_Object *obj, void *event_info)
1829 mf_retm_if(data == NULL, "data is NULL");
1830 mf_retm_if(obj == NULL, "obj is NULL");
1831 struct appdata *ap = (struct appdata *)data;
1832 Elm_Object_Item *it = ap->mf_Status.pPreNaviItem;
1834 SAFE_DEL_NAVI_ITEM(it);
1835 ap->mf_Status.pPreNaviItem = NULL;
1836 mf_widget_set_navi_blocking(ap, EINA_FALSE);
1837 evas_object_smart_callback_del(obj, "transition,finished", mf_navi_bar_transition_finished_cb);
1841 void mf_navi_bar_remove_previous_contents(void *data, Evas_Object *pNaviBar)
1844 mf_retm_if(data == NULL, "data is NULL");
1845 mf_retm_if(pNaviBar == NULL, "pNaviBar is NULL");
1846 struct appdata *ap = (struct appdata *)data;
1848 if (ap->mf_Status.pPreNaviItem != NULL) {
1849 mf_widget_set_navi_blocking(data, EINA_TRUE);
1850 evas_object_smart_callback_add(pNaviBar, "transition,finished", mf_navi_bar_transition_finished_cb, data);
1855 void mf_navi_bottom_item_del(Elm_Object_Item **pPreNaviItem)
1858 mf_retm_if(*pPreNaviItem == NULL, "pPreNaviItem is NULL");
1859 SAFE_DEL_NAVI_ITEM(*pPreNaviItem);
1860 *pPreNaviItem = NULL;
1864 myfileNaviBar *mf_navi_bar_get_navi_from_navilist(Eina_List *navilist, const char *label)
1868 mf_retvm_if(navilist == NULL, NULL, "navilist is NULL");
1869 mf_retvm_if(label == NULL, NULL, "label is NULL");
1872 myfileNaviBar *pNavi = NULL;
1873 Eina_List *l = NULL;
1874 EINA_LIST_FOREACH(navilist, l, data) {
1876 pNavi = (myfileNaviBar *)data;
1877 if (pNavi && pNavi->pNaviLabel && g_strcmp0(label, pNavi->pNaviLabel) == 0)
1887 void mf_navi_bar_del_item_directly(void *data)
1890 mf_retm_if(data == NULL, "data is NULL");
1891 struct appdata *ap = (struct appdata *)data;
1893 if (ap->mf_Status.flagNaviPush) {
1894 if(ap->mf_Status.pPreNaviItem)
1896 SAFE_DEL_NAVI_ITEM(ap->mf_Status.pPreNaviItem);
1897 mf_widget_set_navi_blocking(ap, EINA_FALSE);
1898 evas_object_smart_callback_del(ap->mf_MainWindow.pNaviBar, "transition,finished", mf_navi_bar_transition_finished_cb);
1903 void mf_navi_bar_button_set_disable(Elm_Object_Item *navi_it, int disable_item, bool disable)
1905 mf_retm_if(navi_it == NULL, "navi_it is NULL");
1906 Evas_Object *btn = NULL;
1907 if (disable_item & CTRL_DISABLE_EDIT) {
1908 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1909 const char *button_label = elm_object_text_get(btn);
1910 if (g_strcmp0(button_label, GET_SYS_STR(MF_LABEL_EDIT)) == 0)
1911 elm_object_disabled_set(btn, disable);
1914 if (disable_item & CTRL_DISABLE_DELETE) {
1915 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1916 const char *button_label = elm_object_text_get(btn);
1917 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_DELETE)) == 0)
1918 elm_object_disabled_set(btn, disable);
1921 if (disable_item & CTRL_DISABLE_SEND) {
1922 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
1923 const char *button_label = elm_object_text_get(btn);
1924 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_SHARE)) == 0)
1925 elm_object_disabled_set(btn, disable);
1928 if (disable_item & CTRL_DISABLE_COPY_HERE) {
1929 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1930 const char *button_label = elm_object_text_get(btn);
1931 if (g_strcmp0(button_label, GET_STR(LABEL_COPY_HERE)) == 0)
1932 elm_object_disabled_set(btn, disable);
1935 if (disable_item & CTRL_DISABLE_MOVE_HERE) {
1936 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1937 const char *button_label = elm_object_text_get(btn);
1938 if (g_strcmp0(button_label, GET_STR(LABEL_MOVE_HERE)) == 0)
1939 elm_object_disabled_set(btn, disable);
1942 if (disable_item & CTRL_DISABLE_CREATE) {
1943 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
1944 const char *button_label = elm_object_text_get(btn);
1945 if (g_strcmp0(button_label, GET_SYS_STR(MF_LABEL_CREATE_FOLDER)) == 0)
1946 elm_object_disabled_set(btn, disable);
1949 if (disable_item & CTRL_DISABLE_MORE) {
1950 btn = elm_object_item_part_content_get(navi_it, NAVI_MORE_BUTTON_PART);
1951 elm_object_disabled_set(btn, disable);
1956 int mf_navi_bar_button_get_disable(Elm_Object_Item *navi_it)
1958 mf_retvm_if(navi_it == NULL, 0, "navi_it is NULL");
1959 int disable_item = 0;
1960 const char *button_label = NULL;
1962 Evas_Object *btn = NULL;
1963 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1964 button_label = elm_object_text_get(btn);
1965 if(elm_object_disabled_get(btn)) {
1966 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_DELETE)) == 0) {
1967 disable_item |= CTRL_DISABLE_DELETE;
1971 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
1972 button_label = elm_object_text_get(btn);
1973 if(elm_object_disabled_get(btn)) {
1974 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_SHARE)) == 0) {
1975 disable_item |= CTRL_DISABLE_SEND;
1979 return disable_item;
1982 void mf_navi_bar_set_toolbar_visible(Elm_Object_Item *navi_item, bool visible)
1984 mf_retm_if(navi_item == NULL, "navi_item is NULL");
1986 mf_debug("visible: %d", visible);
1988 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,open", "");
1990 elm_object_item_signal_emit(navi_item, "elm,state,toolbar,close", "");