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, &(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;
240 MF_TA_ACUM_ITEM_BEGIN(" mf_util_generate_file_list", 0);
241 error_code = mf_util_generate_file_list(ap);
242 MF_TA_ACUM_ITEM_END(" mf_util_generate_file_list", 0);
243 if (error_code != MYFILE_ERR_NONE) {
244 /*Todo: we need to free all the Eina_List*/
247 MF_TA_ACUM_ITEM_BEGIN(" mf_util_sort_the_file_list", 0);
249 /* sort the list by sort_type*/
250 mf_util_sort_the_file_list(ap);
251 MF_TA_ACUM_ITEM_END(" mf_util_sort_the_file_list", 0);
253 MF_TA_ACUM_ITEM_BEGIN(" No content check", 0);
254 file_list = ap->mf_FileOperation.file_list;
255 dir_list = ap->mf_FileOperation.folder_list;
257 dir_list_len = eina_list_count(dir_list);
258 file_list_len = eina_list_count(file_list);
260 if ((dir_list_len + file_list_len) > 0) {
261 ap->mf_Status.flagNoContent = EINA_FALSE;
263 ap->mf_Status.flagNoContent = EINA_TRUE;
265 MF_TA_ACUM_ITEM_END(" No content check", 0);
267 ap->mf_MainWindow.pNaviGenlist = NULL;
268 ap->mf_MainWindow.pNaviGengrid = NULL;
270 if (ap->mf_Status.flagNoContent) {
271 MF_TA_ACUM_ITEM_BEGIN(" No content create", 0);
272 pContent = mf_widget_create_no_content(ap->mf_MainWindow.pNaviBar);
273 MF_TA_ACUM_ITEM_END(" No content create", 0);
275 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_THUMBNAIL) {
276 pContent = mf_gengrid_create_list(ap, ap->mf_MainWindow.pNaviBar);
277 ap->mf_MainWindow.pNaviGengrid = pContent;
279 MF_TA_ACUM_ITEM_BEGIN(" genlist view create", 0);
280 pContent = mf_genlist_create_list(ap, ap->mf_MainWindow.pNaviBar);
281 MF_TA_ACUM_ITEM_END(" genlist view create", 0);
282 ap->mf_MainWindow.pNaviGenlist = pContent;
285 if (ap->mf_Status.more == MORE_DEFAULT) {
286 MF_TA_ACUM_ITEM_BEGIN(" Add dir monitor", 0);
287 mf_callback_add_dir_watch(ap->mf_Status.path->str, ap);
288 MF_TA_ACUM_ITEM_END(" Add dir monitor", 0);
295 /******************************
296 ** Prototype : mfNaviBarSetContent
298 ** Input : Evas_Object *pLayout
299 ** Evas_Object *NaviContent
306 ** 1.Date : 2010/12/10
308 ** Modification : Created function
310 ******************************/
311 static int __mf_navi_bar_reset_content_idler(void *data)
315 struct appdata *ap = (struct appdata *)data;
317 SAFE_FREE_OBJ(ap->mf_Status.old_content);
318 ap->mf_Status.navi_content_idler = NULL;
322 return ECORE_CALLBACK_CANCEL;
325 void mfNaviBarSetContent(void *data, Evas_Object *pLayout, Evas_Object *NaviContent)
327 mf_retm_if(data == NULL, "data is NULL");
328 mf_retm_if(pLayout == NULL, "pConform is NULL");
329 mf_retm_if(NaviContent == NULL, "NaviContent is NULL");
331 struct appdata *ap = (struct appdata *)data;
332 Evas_Object *unUsed = mf_widget_unset_part_content(pLayout, "content");
333 evas_object_hide(unUsed);
334 ap->mf_Status.old_content = unUsed;
335 mf_ecore_idler_del(ap->mf_Status.navi_content_idler);
336 ap->mf_Status.navi_content_idler = ecore_idler_add((Ecore_Task_Cb)__mf_navi_bar_reset_content_idler, ap);
337 /*if bs, use idler here*/
338 elm_object_part_content_set(pLayout, "content", NaviContent);
341 Evas_Object *mf_navi_bar_get_content(Evas_Object *pConform)
343 return elm_object_content_get(pConform);
346 /******************************
347 ** Prototype : mf_navi_bar_set_style
349 ** Input : struct appdata* data
350 ** eNaviBarStyle navi_style
351 ** Evas_Object *NaviContent
358 ** 1.Date : 2010/12/10
360 ** Modification : Created function
362 ******************************/
363 static void __mf_navi_bar_title(void *data)
366 mf_retm_if(data == NULL, "data is NULL");
367 struct appdata *ap = (struct appdata *)data;
369 Evas_Object *pNavi = ap->mf_MainWindow.pNaviBar;
370 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
371 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
373 Evas_Object *unset = NULL;
374 int more = ap->mf_Status.more;
376 Evas_Object *label = elm_label_add(pNavi);
377 // set the label style
378 elm_object_style_set(label, "naviframe_title");
379 // set the label for the title slide mode
380 elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO);
381 elm_label_wrap_width_set(label, 1);
382 elm_label_ellipsis_set(label, EINA_TRUE);
383 // set the label text
384 if (more == MORE_EDIT) {
385 elm_object_text_set(label, GET_SYS_STR(MF_LABEL_EDIT));
386 } else if (more == MORE_SHARE_EDIT) {
387 elm_object_text_set(label, GET_SYS_STR(LABEL_SHARE));
390 elm_object_text_set(label, pNavi_s->pNaviTitle);
392 evas_object_show(label);
393 unset = elm_object_item_part_content_unset(navi_it, "elm.swallow.title");
394 SAFE_FREE_OBJ(unset);
395 elm_object_item_part_content_set(navi_it, "elm.swallow.title", label);
398 void mf_navi_bar_title_set(void *data)
401 mf_retm_if(data == NULL, "data is NULL");
402 struct appdata *ap = (struct appdata *)data;
403 int more = ap->mf_Status.more;
404 char *path = ap->mf_Status.path->str;
405 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
406 Evas_Object *pNavi = ap->mf_MainWindow.pNaviBar;
407 Evas_Object *unset = NULL;
409 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
411 if (ap->mf_Status.more == MORE_CREATE_FOLDER
412 || ap->mf_Status.more == MORE_THUMBNAIL_RENAME
413 || ap->mf_Status.more == MORE_SEARCH
414 || ap->mf_Status.more == MORE_EDIT
415 || ap->mf_Status.more == MORE_SHARE_EDIT) {
416 __mf_navi_bar_title(ap);
417 } else if (more != MORE_EDIT && more != MORE_SEARCH) {
418 if (ap->mf_Status.view_type != mf_view_root) {
419 Evas_Object *home_btn = elm_button_add(pNavi);
420 //elm_object_style_set(home_btn, TITLE_BTN_STYLE);
421 elm_object_style_set(home_btn, "naviframe/title_icon");
422 Evas_Object *home_ic = elm_image_add(pNavi);
423 elm_image_file_set(home_ic, MF_TITLE_ICON_HOME, NULL);
424 elm_image_resizable_set(home_ic, EINA_TRUE, EINA_TRUE);
425 elm_object_content_set(home_btn, home_ic);
426 mf_language_mgr_register_object(home_btn, OBJ_TYPE_ELM_OBJECT, NULL, MF_LABEL_HOME);
427 evas_object_smart_callback_add(home_btn, "clicked", mf_callback_home_button_cb, ap);
428 evas_object_smart_callback_add(home_btn, "pressed", mf_callback_home_button_pressed_cb, home_ic);
429 evas_object_smart_callback_add(home_btn, "unpressed", mf_callback_home_button_unpressed_cb, home_ic);
430 evas_object_show(home_btn);
432 unset = elm_object_item_part_content_unset(navi_it, TITLE_LEFT_BTN);
433 SAFE_FREE_OBJ(unset);
434 elm_object_item_part_content_set(navi_it, TITLE_LEFT_BTN, home_btn);
436 Evas_Object *up_btn = elm_button_add(pNavi);
437 //elm_object_style_set(up_btn, TITLE_BTN_STYLE);
438 elm_object_style_set(up_btn, "naviframe/title_icon");
439 Evas_Object *up_ic = elm_image_add(pNavi);
440 elm_image_file_set(up_ic, MF_TITLE_ICON_UPPER, NULL);
441 elm_image_resizable_set(up_ic, EINA_TRUE, EINA_TRUE);
442 elm_object_content_set(up_btn, up_ic);
443 mf_language_mgr_register_object(up_btn, OBJ_TYPE_ELM_OBJECT, NULL, MF_LABEL_UPPER);
444 evas_object_smart_callback_add(up_btn, "clicked", mf_callback_upper_click_cb, ap);
445 evas_object_smart_callback_add(up_btn, "pressed", mf_callback_upper_button_pressed_cb, up_ic);
446 evas_object_smart_callback_add(up_btn, "unpressed", mf_callback_upper_button_unpressed_cb, up_ic);
447 evas_object_show(up_btn);
448 unset = elm_object_item_part_content_unset(navi_it, TITLE_RIGHT_BTN);
449 SAFE_FREE_OBJ(unset);
450 elm_object_item_part_content_set(navi_it, TITLE_RIGHT_BTN, up_btn);
453 __mf_navi_bar_title(ap);
456 elm_naviframe_item_title_visible_set(navi_it, EINA_TRUE);
461 void mf_navi_bar_set_style(void *data, eNaviBarStyle navi_style, Evas_Object *NaviContent)
463 mf_retm_if(data == NULL, "data is NULL");
464 struct appdata *ap = (struct appdata *)data;
466 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
467 Evas_Object *NaviBar = ap->mf_MainWindow.pNaviBar;
468 mf_retm_if(NaviBar == NULL, "Navi bar is NULL");
469 Evas_Object *pConform = ap->mf_MainWindow.pNaviLayout;
470 mf_retm_if(pConform == NULL, "Conformant is NULL");
471 Evas_Object *l_button = ap->mf_MainWindow.pNaviLeftBtn;
472 Elm_Object_Item *navi_it = NULL;
474 char *title = pNavi_s->pNaviTitle;
475 mfNaviBarSetContent(ap, pConform, NaviContent);
477 switch (navi_style) {
478 case NAVI_BAR_DEFAULT: /*when MMC is off, show "myfile" only*/
479 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
480 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
481 navi_it = elm_naviframe_item_push(NaviBar, NULL, NULL, NULL, pConform, MF_NAVI_STYLE_ENABLE);
483 ap->mf_MainWindow.pNaviItem = navi_it;
485 case NAVI_BAR_PATH_WITH_ONE_ACTION:
486 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
487 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
488 navi_it = elm_naviframe_item_push(NaviBar, NULL, l_button, NULL, pConform, MF_NAVI_STYLE_ENABLE);
489 ap->mf_MainWindow.pNaviItem = navi_it;
497 /******************************
498 ** Prototype : __mf_navi_bar_select_count_label_timeout_cb
500 ** Input : void *data
509 ** 1.Date : 2010/12/10
511 ** Modification : Created function
513 ******************************/
517 void mf_navi_bar_set_upper_item_disable(void *data, bool bFlag)
519 struct appdata *ap = (struct appdata *)data;
520 mf_retm_if(ap == NULL, "ap is NULL");
521 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
522 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
524 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
525 Elm_Object_Item *pUpperItem = NULL;
526 Evas_Object *upper_genlist = NULL;
528 upper_genlist = __mf_navi_bar_get_upper_genlist(ap->mf_MainWindow.pNaviInfoBox);
529 pUpperItem = elm_genlist_first_item_get(upper_genlist);
531 mfItemData_s *itemData = elm_object_item_data_get(pUpperItem);
533 if (itemData && itemData->m_ItemName && itemData->m_ItemName->str
534 && g_strcmp0(itemData->m_ItemName->str, ap->mf_Status.upper_folder) == 0) {
535 elm_object_item_disabled_set(pUpperItem, bFlag);
541 Evas_Object *__mf_navi_bar_backbutton_create(Evas_Object *parent, Evas_Object *win)
544 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
545 mf_retvm_if(win == NULL, NULL, "win is NULL");
547 Evas_Object *btn = NULL;
548 btn = elm_button_add(parent);
549 elm_object_style_set(btn, "naviframe/end_btn/default");
550 evas_object_show(btn);
554 Evas_Object *mf_navi_bar_pathinfo_label_create(Evas_Object *parent, char *pathinfo)
557 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
558 mf_retvm_if(pathinfo == NULL, NULL, "pathinfo is NULL");
559 Evas_Object *label = NULL;
561 label = elm_label_add(parent);
562 elm_object_focus_set(label, EINA_FALSE);
563 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
564 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
565 elm_object_text_set(label, pathinfo);
566 evas_object_show(label);
567 SAFE_FREE_CHAR(pathinfo);
572 Evas_Object *__mf_navi_bar_pathinfo_create(Evas_Object *parent, const char *content)
575 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
576 mf_retvm_if(content == NULL, NULL, "content is NULL");
578 Evas_Object *layout = NULL;
580 layout = elm_layout_add(parent);
581 elm_object_focus_set(layout, EINA_FALSE);
582 elm_layout_file_set(layout, EDJ_NAME, GRP_PATH_INFO);
583 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
584 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
586 //elm_object_part_content_set(layout, "info", content);
587 elm_object_part_text_set(layout, "info", content);
588 evas_object_show(layout);
593 void mf_navi_add_back_button(void *data)
596 mf_retm_if(data == NULL, "data is NULL");
598 struct appdata *ap = (struct appdata *)data;
600 Evas_Object *pBackButton = NULL;
602 pBackButton = __mf_navi_bar_backbutton_create(ap->mf_MainWindow.pNaviBar, ap->mf_MainWindow.pWindow);
604 Evas_Object *unset = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, "prev_btn");
605 SAFE_FREE_OBJ(unset);
606 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", pBackButton);
607 evas_object_smart_callback_add(pBackButton, "clicked", mf_callback_backbutton_clicked_cb, ap);
611 void mf_navi_remove_home_upper_button(void *data)
614 mf_retm_if(data == NULL, "data is NULL");
616 struct appdata *ap = (struct appdata *)data;
618 if (ap->mf_Status.view_type != mf_view_root) {
619 Evas_Object *btn = NULL;
620 btn = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, TITLE_LEFT_BTN);
622 btn = elm_object_item_part_content_unset(ap->mf_MainWindow.pNaviItem, TITLE_RIGHT_BTN);
627 Evas_Object *mf_navi_bar_upper_create(Evas_Object *parent)
630 mf_retvm_if(parent == NULL, NULL, "parent is NULL");
632 Evas_Object *upper_genlist = NULL;
633 upper_genlist = elm_genlist_add(parent);
634 mf_retvm_if(upper_genlist == NULL, NULL, "upper_genlist is NULL");
635 elm_object_focus_set(upper_genlist, EINA_FALSE);
636 evas_object_size_hint_weight_set(upper_genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
637 evas_object_size_hint_align_set(upper_genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
638 elm_scroller_bounce_set(upper_genlist, EINA_FALSE, EINA_FALSE);
639 evas_object_show(upper_genlist);
641 return upper_genlist;
645 void mf_navi_bar_remove_back_button(Elm_Object_Item *pNaviItem)
648 mf_retm_if(pNaviItem == NULL, "pNaviItem is NULL");
649 Evas_Object *back_btn = NULL;
651 back_btn = elm_object_item_part_content_get(pNaviItem, "prev_btn");
652 if (back_btn != NULL) {
653 elm_object_item_part_content_unset(pNaviItem, "prev_btn");
654 evas_object_hide(back_btn);
655 evas_object_del(back_btn);
660 Evas_Object *mf_navi_bar_create_header_box(void *data)
663 mf_retvm_if(data == NULL, NULL, "data is NULL");
665 struct appdata *ap = (struct appdata *)data;
666 Evas_Object *box = NULL;
667 Evas_Object *pathinfo_layout = NULL;
668 char *pathinfo = NULL;
671 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
672 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
673 mf_retvm_if(pNavi_s == NULL, NULL, "pNavi_s is NULL");
675 //box = mf_widget_create_box(ap->mf_MainWindow.pNaviBox);
676 //evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
677 //evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
678 //elm_box_clear(box);
683 pathinfo = mf_fm_svc_path_info_get(ap->mf_Status.path->str);
684 info = mf_fm_svc_path_info_translate(pathinfo, MF_PATH_INFO_MAX_LENGTH_PORTRAIT);
687 //Evas_Object *genlist = mf_genlist_create_path_info(box, info);
688 pathinfo_layout = __mf_navi_bar_pathinfo_create(ap->mf_MainWindow.pNaviBox, info);
689 evas_object_size_hint_weight_set(pathinfo_layout, EVAS_HINT_EXPAND, 0);
690 evas_object_size_hint_align_set(pathinfo_layout, EVAS_HINT_FILL, 0.0);
691 //evas_object_show(genlist);
694 upper_layout = elm_layout_add(box);
695 elm_object_focus_set(upper_layout, EINA_FALSE);
696 ret = elm_layout_file_set(upper_layout, EDJ_NAME, "upper_folder");
697 evas_object_size_hint_weight_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);//(upper_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
698 evas_object_size_hint_align_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
699 evas_object_show(upper_layout);
700 elm_box_pack_end(box, upper_layout);
703 //elm_box_pack_start(box, pathinfo_layout);
704 evas_object_show(pathinfo_layout);
707 return pathinfo_layout;
710 void mf_navi_bar_set_ctrl_button(void *data)
713 mf_retm_if(data == NULL, "data is NULL");
714 struct appdata *ap = (struct appdata *)data;
715 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
716 Evas_Object *more_bt = NULL;
717 Evas_Object *bt_1 = NULL;
718 Evas_Object *bt_2 = NULL;
719 switch(ap->mf_Status.more) {
721 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
722 if (ap->mf_Status.view_type == mf_view_root) {
723 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);
725 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, MF_LABEL_EDIT, NULL, mf_callback_edit_cb, ap);
726 bt_2 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_SHARE, NULL, mf_callback_edit_cb, ap);
730 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
731 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_DELETE, NULL, mf_callback_delete_cb, ap);
732 //bt_2 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_SHARE, NULL, mf_callback_share_cb, ap);
734 case MORE_INTERNAL_COPY:
735 case MORE_DATA_COPYING:
736 if (ap->mf_Status.view_type != mf_view_root) {
737 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
739 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_COPY_HERE, NULL, mf_callback_paste_here_cb, ap);
741 case MORE_INTERNAL_MOVE:
742 case MORE_DATA_MOVING:
743 if (ap->mf_Status.view_type != mf_view_root) {
744 more_bt = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_EDIT, MF_LABEL_MORE, NULL, mf_callback_more_button_cb, ap);
746 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_MOVE_HERE, NULL, mf_callback_move_here_cb, ap);
748 case MORE_SHARE_EDIT:
749 bt_1 = mf_widget_util_create_button(ap->mf_MainWindow.pNaviBar, NAVI_BUTTON_STYLE, LABEL_SHARE, NULL, mf_callback_share_cb, ap);
754 elm_object_item_part_content_set(navi_it, NAVI_MORE_BUTTON_PART, more_bt);
757 elm_object_item_part_content_set(navi_it, NAVI_BOTTOM_BUTTON_1_PART, bt_1);
760 elm_object_item_part_content_set(navi_it, NAVI_BOTTOM_BUTTON_2_PART, bt_2);
764 void mf_navi_bar_reset_ctrl_button(void *data)
767 mf_retm_if(data == NULL, "data is NULL");
768 struct appdata *ap = (struct appdata *)data;
769 Elm_Object_Item *navi_it = ap->mf_MainWindow.pNaviItem;
770 mf_retm_if(navi_it == NULL, "navi_it is NULL");
772 Evas_Object *more_bt = NULL;
773 Evas_Object *bt_1 = NULL;
774 Evas_Object *bt_2 = NULL;
775 more_bt = elm_object_item_part_content_unset(navi_it, NAVI_MORE_BUTTON_PART);
776 SAFE_FREE_OBJ(more_bt);
777 bt_1 = elm_object_item_part_content_unset(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
779 bt_2 = elm_object_item_part_content_unset(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
781 mf_navi_bar_set_ctrl_button(ap);
783 void mf_navi_bar_create_default_view(void *data)
786 struct appdata *ap = (struct appdata *)data;
788 GString *title = NULL;
789 Evas_Object *newContent = NULL;
790 Evas_Object *box = NULL;
791 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
792 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
793 mf_retm_if(ap->mf_MainWindow.pNaviBar == NULL, "ap->mf_MainWindow.pNaviBar is NULL");
795 __mf_navi_bar_reset_navi_obj(ap);
797 MF_TA_ACUM_ITEM_BEGIN(" create view box", 0);
798 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
799 MF_TA_ACUM_ITEM_END(" create view box", 0);
801 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
803 MF_TA_ACUM_ITEM_BEGIN(" create genlist", 0);
804 newContent = mf_navi_bar_content_create(ap);
805 MF_TA_ACUM_ITEM_END(" create genlist", 0);
806 /*set title segment or title*/
807 evas_object_show(newContent);
808 MF_TA_ACUM_ITEM_BEGIN(" set title", 0);
809 if (ap->mf_Status.view_type == mf_view_root) {
810 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
811 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
812 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
814 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
816 MF_TA_ACUM_ITEM_END(" set title", 0);
818 MF_TA_ACUM_ITEM_BEGIN(" set content of conform", 0);
821 pNavi_s->pNaviTitle = g_strdup(title->str);
822 g_string_free(title, TRUE);
826 /*navigation view integration*/
827 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newContent);
828 MF_TA_ACUM_ITEM_END(" set content of conform", 0);
830 MF_TA_ACUM_ITEM_BEGIN(" set conform to box", 0);
831 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviLayout);
832 MF_TA_ACUM_ITEM_END(" set conform to box", 0);
834 MF_TA_ACUM_ITEM_BEGIN(" create header box", 0);
835 if (ap->mf_Status.view_type == mf_view_normal
837 box = mf_navi_bar_create_header_box(ap);
839 ap->mf_MainWindow.pNaviInfoBox = box;
840 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, box);
843 MF_TA_ACUM_ITEM_END(" create header box", 0);
845 MF_TA_ACUM_ITEM_BEGIN(" push view to navibar", 0);
847 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
849 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
850 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, MF_NAVI_STYLE_ENABLE);
852 MF_TA_ACUM_ITEM_END(" push view to navibar", 0);
854 MF_TA_ACUM_ITEM_BEGIN(" add backbutton", 0);
855 if (ap->mf_Status.more != MORE_INTERNAL_COPY && ap->mf_Status.more != MORE_INTERNAL_MOVE) {
856 mf_navi_add_back_button(ap);
858 MF_TA_ACUM_ITEM_END(" add backbutton", 0);
860 /*add control bar for navigation bar*/
861 MF_TA_ACUM_ITEM_BEGIN(" add control bar", 0);
862 //mf_navi_bar_set_ctrl_bar(ap);
864 mf_navi_bar_set_ctrl_button(data);
865 MF_TA_ACUM_ITEM_END(" add control bar", 0);
867 MF_TA_ACUM_ITEM_BEGIN(" set control bar", 0);
868 if (ap->mf_Status.flagNoContent == 1) {
869 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, true);
871 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_NOCONTENT_VIEW, FALSE);
873 #ifdef MYFILE_USB_OTG
874 if(mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
875 ap->mf_Otg.rootpath_box = ap->mf_MainWindow.pNaviBox;
876 ap->mf_Otg.rootpath_layout = ap->mf_MainWindow.pNaviLayout;
877 ap->mf_Otg.rootpath_navi_item = ap->mf_MainWindow.pNaviItem;
878 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
879 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_OTG_ROOT, TRUE);
882 MF_TA_ACUM_ITEM_END(" set control bar", 0);
883 mf_navi_bar_title_set(ap);
888 /******************************
889 ** Prototype : mf_navi_bar_create_edit_view
891 ** Input : void *data
898 ** 1.Date : 2010/12/10
900 ** Modification : Created function
902 ******************************/
903 void mf_navi_bar_remove_path_info(void *data)
906 struct appdata *ap = (struct appdata *)data;
907 mf_retm_if(ap == NULL, "ap is NULL");
909 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
910 elm_box_unpack(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviPathInfo);
911 evas_object_hide(ap->mf_MainWindow.pNaviPathInfo);
912 //evas_object_del(pNavi_s->pNaviPathInfo);
913 ap->mf_MainWindow.pEditView.pPathInfo = ap->mf_MainWindow.pNaviPathInfo;
915 ap->mf_MainWindow.pEditView.pPathInfo = NULL;
920 void mf_navi_bar_recover_path_info(void *data, myfileNaviBar *pNavi_s)
923 struct appdata *ap = (struct appdata *)data;
924 mf_retm_if(ap == NULL, "ap is NULL");
926 if (ap->mf_MainWindow.pEditView.pPathInfo) {
927 ap->mf_MainWindow.pNaviPathInfo = ap->mf_MainWindow.pEditView.pPathInfo;
928 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviPathInfo);
929 evas_object_show(ap->mf_MainWindow.pEditView.pPathInfo);
936 void mf_navi_bar_remove_info_box(void *data)
939 struct appdata *ap = (struct appdata *)data;
940 mf_retm_if(ap == NULL, "ap is NULL");
942 if (!mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
943 elm_box_unpack(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviInfoBox);
944 evas_object_hide(ap->mf_MainWindow.pNaviInfoBox);
945 ap->mf_MainWindow.pEditView.pInfoBox = ap->mf_MainWindow.pNaviInfoBox;
947 ap->mf_MainWindow.pEditView.pInfoBox = NULL;
952 void mf_navi_bar_recover_info_box(void *data, myfileNaviBar *pNavi_s)
955 struct appdata *ap = (struct appdata *)data;
956 mf_retm_if(ap == NULL, "ap is NULL");
958 if (ap->mf_MainWindow.pEditView.pInfoBox) {
959 ap->mf_MainWindow.pNaviInfoBox = ap->mf_MainWindow.pEditView.pInfoBox;
960 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviInfoBox);
961 evas_object_show(ap->mf_MainWindow.pEditView.pInfoBox);
968 void mf_navi_bar_edit_list_update(void *data)
971 mf_retm_if(data == NULL, "data is NULL");
973 struct appdata *ap = (struct appdata *)data;
975 if (ap->mf_Status.flagViewType == MF_VIEW_STYLE_LIST || ap->mf_Status.flagViewType == MF_VIEW_SYTLE_LIST_DETAIL) {
976 if (ap->mf_MainWindow.pNaviGenlist) {
977 mf_genlist_sweep_item_recover(ap->mf_MainWindow.pNaviGenlist);
978 mf_genlist_update_edit_view_item_style(ap);
979 if (ap->mf_Status.more == MORE_SHARE_EDIT) {
980 mf_genlist_set_folder_edit_style();
982 ap->mf_MainWindow.pEditView.pGenlist = ap->mf_MainWindow.pNaviGenlist;
983 elm_genlist_decorate_mode_set(ap->mf_MainWindow.pNaviGenlist, EINA_TRUE);
986 Eina_List *file_list = NULL;
987 Eina_List *dir_list = NULL;
990 if (ap->mf_Status.view_type == mf_view_root_category) {
991 file_list = ap->mf_FileOperation.category_list;
993 file_list = ap->mf_FileOperation.file_list;
994 dir_list = ap->mf_FileOperation.folder_list;
997 if (ap->mf_MainWindow.pNaviGengrid) {
998 elm_gengrid_clear(ap->mf_MainWindow.pNaviGengrid);
999 mf_gengrid_create_list_default_style(ap->mf_MainWindow.pNaviGengrid, ap, dir_list, file_list);
1000 ap->mf_MainWindow.pEditView.pGengrid = ap->mf_MainWindow.pNaviGengrid;
1007 void mf_navi_bar_create_edit_view(void *data)
1010 struct appdata *ap = (struct appdata *)data;
1011 mf_retm_if(ap == NULL, "ap is NULL");
1013 //Evas_Object *pSelectAllLayout = NULL;
1014 /*get navigation bar to create view*/
1015 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1016 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1018 ap->mf_MainWindow.pEditView.pBox = ap->mf_MainWindow.pNaviBox;
1020 mf_navi_bar_remove_info_box(ap);
1021 /*create conformant*/
1022 mf_navi_remove_home_upper_button(ap);
1024 Evas_Object *select_all_btn = elm_button_add(ap->mf_MainWindow.pNaviBar);
1025 elm_object_style_set(select_all_btn, "naviframe/title_icon");
1026 Evas_Object *select_all_ic = elm_image_add(ap->mf_MainWindow.pNaviBar);
1027 elm_image_file_set(select_all_ic, MF_TITLE_ICON_SELECT_ALL, NULL);
1028 elm_image_resizable_set(select_all_ic, EINA_TRUE, EINA_TRUE);
1029 elm_object_content_set(select_all_btn, select_all_ic);
1030 evas_object_smart_callback_add(select_all_btn, "clicked", (Evas_Smart_Cb)__mf_genlist_select_all_layout_mouse_down_cb, ap);
1031 evas_object_smart_callback_add(select_all_btn, "pressed", (Evas_Smart_Cb)mf_callback_select_all_button_pressed_cb, select_all_ic);
1032 evas_object_smart_callback_add(select_all_btn, "unpressed", (Evas_Smart_Cb)mf_callback_select_all_button_unpressed_cb, select_all_ic);
1033 evas_object_show(select_all_btn);
1034 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, TITLE_RIGHT_BTN, select_all_btn);
1036 mf_navi_bar_title_set(ap);
1037 mf_navi_bar_reset_ctrl_button(ap);
1040 if (ap->mf_Status.flagViewType != MF_VIEW_STYLE_THUMBNAIL) {
1041 Elm_Object_Item *it;
1042 it = elm_genlist_first_item_get(ap->mf_MainWindow.pNaviGenlist);
1044 elm_genlist_item_fields_update(it, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1045 it = elm_genlist_item_next_get(it);
1050 //mf_ctrl_bar_reset(ap);
1051 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_EDIT_ALL, TRUE);
1052 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_EDIT_ALL, true);
1053 /** Todo: should we add segment status set here?*/
1058 /******************************
1059 ** Prototype : mf_navi_bar_create_path_select_view
1061 ** Input : void *data
1068 ** 1.Date : 2010/12/10
1070 ** Modification : Created function
1072 ******************************/
1073 void mf_navi_bar_create_path_select_view(void *data)
1076 struct appdata *ap = (struct appdata *)data;
1077 GString *title = NULL;
1078 Evas_Object *newContent = NULL;
1079 Evas_Object *box = NULL;
1080 /*get navigation bar to create view*/
1081 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1082 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1085 pNavi_s->pre_more = ap->mf_Status.more;
1086 /*create conformant*/
1088 __mf_navi_bar_reset_navi_obj(ap);
1090 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1091 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
1093 newContent = mf_navi_bar_content_create(ap);
1095 /*set title segment or title*/
1096 if (ap->mf_Status.view_type == mf_view_root) {
1097 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1098 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
1099 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1101 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
1104 if (title != NULL) {
1106 pNavi_s->pNaviTitle = g_strdup(title->str);
1107 g_string_free(title, TRUE);
1110 mfNaviBarSetContent(ap, ap->mf_MainWindow.pNaviLayout, newContent);
1111 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, ap->mf_MainWindow.pNaviLayout);
1112 if (ap->mf_Status.view_type == mf_view_normal) {
1113 box = mf_navi_bar_create_header_box(ap);
1115 ap->mf_MainWindow.pNaviInfoBox = box;
1116 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, box);
1119 /*Navigation bar Path Select view integration*/
1121 MF_TA_ACUM_ITEM_BEGIN(" push view to navibar", 0);
1122 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1124 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1125 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, MF_NAVI_STYLE_ENABLE);
1126 MF_TA_ACUM_ITEM_END(" push view to navibar", 0);
1128 mf_navi_add_back_button(ap);
1130 /*add control bar for navigation bar*/
1131 //mf_navi_bar_set_ctrl_bar(ap);
1132 mf_navi_bar_set_ctrl_button(data);
1133 #ifdef MYFILE_USB_OTG
1134 /*control bar disable set if in otg root path*/
1135 if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
1136 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_OPT_ROOT, TRUE);
1139 if (ap->mf_Status.view_type == mf_view_root || ap->mf_Status.view_type == mf_view_root_category) {
1140 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
1142 mf_navi_bar_title_set(ap);
1145 /** Todo: should we add segment status set here?*/
1149 void mf_navi_bar_create_path_select_view_otg_root(void *data)
1152 struct appdata *ap = (struct appdata *)data;
1153 GString *title = NULL;
1154 Evas_Object *newContent = NULL;
1156 /*get navigation bar to create view*/
1157 myfileNaviBar *pNavi_s = mf_navi_bar_get_struct_by_label(ap, GET_STR(MF_LABEL_OTG));
1158 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1161 pNavi_s->pre_more = ap->mf_Status.more;
1162 /*create conformant*/
1163 __mf_navi_bar_reset_navi_obj(ap);
1165 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBar, EDJ_NAME, "selectinfo_layout");
1167 ap->mf_MainWindow.pNaviBox = ap->mf_MainWindow.pNaviLayout;
1169 newContent = mf_navi_bar_content_create(ap);
1171 /*set title segment or title*/
1172 if (ap->mf_Status.view_type == mf_view_root) {
1173 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1174 } else if (mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str)) {
1175 title = g_string_new(GET_SYS_STR(LABEL_MYFILE));
1177 title = mf_fm_svc_wrapper_get_file_name(ap->mf_Status.path);
1180 if (title != NULL) {
1182 pNavi_s->pNaviTitle = g_strdup(title->str);
1183 g_string_free(title, TRUE);
1186 /*Navigation bar Path Select view integration*/
1187 mf_navi_bar_set_style(ap, NAVI_BAR_PATH_WITH_ONE_ACTION, newContent);
1188 /*add control bar for navigation bar*/
1189 //mf_navi_bar_set_ctrl_bar(ap);
1190 mf_navi_add_back_button(ap);
1191 mf_navi_bar_set_ctrl_button(data);
1192 mf_navi_bar_title_set(ap);
1193 #ifdef MYFILE_USB_OTG
1194 /*control bar disable set if in otg root path*/
1195 if(mf_fm_svc_wrapper_is_root_path(ap->mf_Status.path->str) == MYFILE_OTG) {
1196 mf_navi_bar_button_set_disable(ap->mf_MainWindow.pNaviItem, CTRL_DISABLE_OTG_ROOT, TRUE);
1197 //mf_ctrl_bar_item_set_disable(ap->mf_MainWindow.pNaviCtrlBar, CTRL_DISABLE_OTG_ROOT, TRUE);
1201 /** Todo: should we add segment status set here?*/
1206 /******************************
1207 ** Prototype : mf_navi_bar_create_search_view
1209 ** Input : void *data
1216 ** 1.Date : 2010/12/10
1218 ** Modification : Created function
1220 ******************************/
1221 #ifdef MYFILE_SPLIT_VIEW
1222 void mf_navi_bar_set_panes_navi_to_main(void *data)
1225 mf_retm_if(data == NULL, "data is NULL");
1226 struct appdata *ap = (struct appdata*)data;
1227 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1229 mf_widget_unset_main_layout_content(ap->mf_MainWindow.sSplitData.pMainLayout);
1230 /***1. unset naviframe from panes/right layout **/
1231 mf_split_view_unset_right_content(ap);
1232 /***2. unset panes from main layout **/
1233 mf_widget_unset_main_layout_content(ap->mf_MainWindow.pMainLayout);
1236 /***3. set naviframe to main layout **/
1237 elm_object_part_content_set(ap->mf_MainWindow.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.pNaviBar);
1242 void mf_navi_bar_reset_panes_main(void *data)
1245 mf_retm_if(data == NULL, "data is NULL");
1246 struct appdata *ap = (struct appdata*)data;
1249 mf_widget_unset_main_layout_content(ap->mf_MainWindow.pMainLayout);
1250 elm_object_part_content_set(ap->mf_MainWindow.sSplitData.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.pNaviBar);
1252 mf_widget_panes_right_set(ap->mf_MainWindow.sSplitData.pPanes, ap->mf_MainWindow.sSplitData.pMainLayout);
1253 /**** 3. set panes to main layout **/
1254 elm_object_part_content_set(ap->mf_MainWindow.pMainLayout, "elm.swallow.content", ap->mf_MainWindow.sSplitData.pPanes);
1255 mf_split_view_show(ap);
1259 void mf_navi_bar_create_search_view(void *data)
1262 struct appdata *ap = (struct appdata *)data;
1264 GString *title = NULL;
1265 Evas_Object *path_label = NULL;
1266 #ifdef MYFILE_SPLIT_VIEW
1267 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1268 mf_navi_bar_set_panes_navi_to_main(ap);
1272 __mf_navi_bar_reset_navi_obj(ap);
1274 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1275 mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
1276 Evas_Object *pSearchViewLayout = NULL;
1277 //ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "selectinfo_layout");
1279 ap->mf_MainWindow.pNaviLayout = mf_widget_create_layout(ap->mf_MainWindow.pNaviBar, EDJ_NAME, "search_view_layout");
1280 ap->mf_MainWindow.pNaviSearchBar = mf_navi_bar_create_search_bar(ap->mf_MainWindow.pNaviLayout, ap);
1281 pSearchViewLayout = ap->mf_MainWindow.pNaviLayout;
1283 path_label = elm_label_add(pSearchViewLayout);
1284 elm_object_focus_set(path_label, EINA_FALSE);
1285 evas_object_size_hint_weight_set(path_label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1286 evas_object_size_hint_align_set(path_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
1287 evas_object_show(path_label);
1288 /*2.2 contribute label content*/
1289 char *path_in_label = mf_fm_svc_wrapper_translate_path(ap->mf_Status.path->str, MF_TRANS_OPTION_LABEL);
1290 char *label_content = g_strconcat(GET_SYS_STR(MF_LABEL_SEARCH), ":", "<br>", path_in_label, NULL);
1291 /*2.3 set style for path_label*/
1292 elm_label_line_wrap_set(path_label, ELM_WRAP_WORD);
1293 elm_object_text_set(path_label, label_content);
1295 elm_object_part_content_set(pSearchViewLayout, "search_bar", ap->mf_MainWindow.pNaviSearchBar);
1296 elm_object_part_content_set(pSearchViewLayout, "content", path_label);
1298 title = g_string_new(GET_SYS_STR(MF_LABEL_SEARCH));
1299 if (title != NULL) {
1300 pNavi_s->pNaviTitle = g_strdup(title->str);
1301 g_string_free(title, TRUE);
1305 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1307 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1308 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(ap->mf_MainWindow.pNaviBar, NULL, NULL, NULL, pSearchViewLayout, MF_NAVI_STYLE_ENABLE);
1311 /*hide Tab Bar in search view*/
1313 /*add control bar for navigation bar*/
1315 if (path_in_label != NULL) {
1316 free(path_in_label);
1317 path_in_label = NULL;
1319 if (label_content != NULL) {
1320 free(label_content);
1321 label_content = NULL;
1323 mf_navi_bar_title_set(ap);
1324 evas_object_show(ap->mf_MainWindow.pSearchEntry);
1326 elm_object_focus_set(ap->mf_MainWindow.pSearchEntry, EINA_TRUE);
1327 mf_navi_bar_remove_previous_contents(ap, ap->mf_MainWindow.pNaviBar);
1332 static void __new_folder_entryfield_create(Evas_Object *parent, void *data)
1335 struct appdata *ap = (struct appdata *)data;
1336 mf_retm_if(ap == NULL, "ap is NULL");
1337 mf_retm_if(parent == NULL, "parent is NULL");
1339 char *fileName = NULL;
1340 GString *dest_fullpath;
1341 static Elm_Entry_Filter_Limit_Size limit_filter;
1342 Evas_Object *entry = NULL;
1343 Evas_Object *edit_field = NULL;
1344 char *fullpath = (char *)malloc(sizeof(char) * MYFILE_FILE_PATH_LEN_MAX);
1345 if (fullpath == NULL) {
1349 mf_widget_create_entryfield(ap, parent, mf_callback_new_folder_changed_cb, NULL);
1350 entry = ap->mf_MainWindow.pEntry;
1352 edit_field = ap->mf_MainWindow.pEditField;
1354 limit_filter.max_char_count = MYFILE_FILE_NAME_LEN_MAX;
1355 limit_filter.max_byte_count = 0;
1357 memset(fullpath, 0, MYFILE_FILE_PATH_LEN_MAX);
1358 fileName = elm_entry_markup_to_utf8(GET_SYS_STR(MF_LABEL_FOLDER));
1359 snprintf(fullpath, (MYFILE_FILE_PATH_LEN_MAX), "%s/%s", (char *)ap->mf_Status.path->str, fileName);
1361 dest_fullpath = g_string_new(fullpath);
1363 elm_entry_markup_filter_append(ap->mf_MainWindow.pEntry, elm_entry_filter_limit_size, &limit_filter);
1364 evas_object_smart_callback_add(ap->mf_MainWindow.pEntry, "maxlength,reached", mf_callback_max_len_reached_cb, ap);
1365 evas_object_smart_callback_add(ap->mf_MainWindow.pEntry, "preedit,changed",
1366 mf_callback_imf_preedit_change_cb, ap);
1368 if (mf_fm_svc_wrapper_detect_duplication(dest_fullpath)) {
1369 mf_debug("dectetion result is TRUE\ndest_fullpath is %s\n", dest_fullpath->str);
1370 error_code = mf_fm_svc_wrapper_file_auto_rename(ap, dest_fullpath, FILE_NAME_WITH_BRACKETS, &dest_fullpath);
1371 mf_debug("rename result is %s\n", dest_fullpath->str);
1372 memset(fullpath, 0, strlen(fullpath));
1373 int len = strlen(ap->mf_Status.path->str) + 1;
1374 strncpy(fullpath, dest_fullpath->str + len, MYFILE_FILE_PATH_LEN_MAX);
1375 /*memset(fileName,0,strlen(fileName));*/
1377 SAFE_FREE_CHAR(fileName);
1378 fileName = elm_entry_markup_to_utf8(fullpath);
1381 /*elm_entry_entry_set(entry, ecore_file_file_get(params->m_ItemName->str));*/
1382 mf_widget_imf_hide_callback_register(ap->mf_MainWindow.pConformant, entry);
1384 elm_entry_entry_set(entry, fileName);
1385 elm_entry_cursor_end_set(entry);
1387 SAFE_FREE_CHAR(fullpath);
1388 SAFE_FREE_GSTRING(dest_fullpath);
1389 SAFE_FREE_CHAR(fileName);
1393 void mf_navi_bar_create_new_folder_view(void *data)
1396 struct appdata *ap = (struct appdata *)data;
1397 mf_retm_if(ap == NULL, "ap is NULL");
1399 Evas_Object *newContent = NULL;
1401 Evas_Object *pNaviBar = NULL;
1402 GString *title = NULL;
1404 mf_widget_set_navi_blocking(data, EINA_TRUE);
1405 #ifdef MYFILE_SPLIT_VIEW
1406 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1407 mf_navi_bar_set_panes_navi_to_main(ap);
1411 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1412 mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
1414 __mf_navi_bar_reset_navi_obj(ap);
1416 pNaviBar = ap->mf_MainWindow.pNaviBar;
1417 ap->mf_MainWindow.pNaviBox = NULL;
1418 ap->mf_MainWindow.pNaviLayout= NULL;
1420 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1421 newContent = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, GRP_NEW_FOLDER);
1422 __new_folder_entryfield_create(newContent, ap);
1423 evas_object_size_hint_weight_set(newContent, EVAS_HINT_EXPAND, 0);
1424 evas_object_size_hint_align_set(newContent, EVAS_HINT_FILL, 0.0);
1425 Evas_Object *pad = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "PAD");
1426 elm_object_part_content_set(newContent, "content", ap->mf_MainWindow.pEditField);
1427 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, newContent);
1428 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, pad);
1429 //newContent = mf_genlist_create_list_new_folder_style(ap);
1430 /*set title segment or title*/
1431 /*navigation view integration*/
1433 title = g_string_new(GET_SYS_STR(MF_LABEL_CREATE_FOLDER));
1435 if (title != NULL) {
1436 pNavi_s->pNaviTitle = g_strdup(title->str);
1437 g_string_free(title, TRUE);
1441 Elm_Object_Item *navi_it = NULL;
1442 //mf_navi_bar_set_style(ap, NAVI_BAR_DEFAULT, newContent);
1443 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1444 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1445 navi_it = elm_naviframe_item_push(pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, NULL);
1447 ap->mf_MainWindow.pNaviItem = navi_it;
1449 mf_navi_bar_title_set(ap);
1450 //mf_navi_add_back_button(ap);
1452 Evas_Object *l_bt = NULL;
1453 Evas_Object *r_bt = NULL;
1455 l_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1456 elm_object_focus_set(l_bt, EINA_FALSE);
1457 elm_object_style_set(l_bt, "naviframe/toolbar/default");
1458 elm_object_text_set(l_bt, GET_SYS_STR(LABEL_SAVE));
1459 mf_language_mgr_register_object(l_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_SAVE);
1460 evas_object_smart_callback_add(l_bt, "clicked", mf_callback_save_cb, ap);
1461 evas_object_show(l_bt);
1462 elm_object_item_part_content_set(navi_it, NAVI_BOTTOM_BUTTON_1_PART, l_bt);
1463 //elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, TITLE_LEFT_BTN, l_bt);
1466 r_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1467 elm_object_focus_set(r_bt, EINA_FALSE);
1468 elm_object_style_set(r_bt, "naviframe/end_btn/default");
1469 //elm_object_style_set(r_bt, TITLE_BTN_STYLE);
1470 //elm_object_text_set(r_bt, GET_SYS_STR(LABEL_CANCEL));
1471 //mf_language_mgr_register_object(r_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_CANCEL);
1472 evas_object_smart_callback_add(r_bt, "clicked", mf_callback_cancel_cb, ap);
1473 evas_object_show(r_bt);
1474 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", r_bt);
1477 mf_callback_imf_state_callback_register(ap);
1479 elm_object_focus_set(ap->mf_MainWindow.pEntry, EINA_TRUE);
1483 static void __rename_entryfield_create(Evas_Object *parent, void *data)
1487 mfItemData_s *params = (mfItemData_s *) data;
1488 mf_retvm_if(params == NULL, NULL, "param is NULL");
1489 mf_retvm_if(params->m_ItemName == NULL, NULL, "m_ItemName is NULL");
1491 struct appdata *ap = (struct appdata *)params->ap;
1492 mf_retvm_if(ap == NULL, NULL, "input parameter data error");
1494 static Elm_Entry_Filter_Limit_Size limit_filter_data;
1495 Evas_Object *edit_field = NULL;
1496 Evas_Object *entry = NULL;
1497 GString *filename = NULL;
1499 mf_widget_create_entryfield(ap, parent, mf_callback_imf_changed_cb, NULL);
1501 entry = ap->mf_MainWindow.pEntry;
1503 edit_field = ap->mf_MainWindow.pEditField;
1505 evas_object_size_hint_weight_set(edit_field, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1506 evas_object_size_hint_align_set(edit_field, EVAS_HINT_FILL, EVAS_HINT_FILL);
1509 elm_entry_single_line_set(entry, EINA_TRUE);
1510 elm_entry_scrollable_set(entry, EINA_TRUE);
1511 elm_object_signal_emit(edit_field, "elm,state,eraser,show", "elm");
1512 //elm_editfield_eraser_set(edit_field, EINA_TRUE);
1514 elm_entry_autocapital_type_set(entry, ELM_AUTOCAPITAL_TYPE_NONE);
1515 elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
1517 if (params->ap->mf_FileOperation.to_rename != NULL) {
1518 g_string_free(params->ap->mf_FileOperation.to_rename, TRUE);
1519 params->ap->mf_FileOperation.to_rename = NULL;
1521 params->ap->mf_FileOperation.to_rename = g_string_new((char *)params->m_ItemName->str);
1524 /* the below is sample code for control entry. It is not mandatory.*/
1526 /* set guide text */
1527 filename = mf_fm_svc_wrapper_get_file_name(ap->mf_FileOperation.to_rename);
1528 char *guide_text = NULL;
1529 SAFE_FREE_CHAR(ap->mf_FileOperation.file_name_suffix);
1530 if (!mf_file_attr_is_dir(ap->mf_FileOperation.to_rename->str)) {
1533 char *name_without_ext = NULL;
1534 name_without_ext = g_strdup(ap->mf_FileOperation.to_rename->str);
1535 mf_file_attr_get_file_ext(ap->mf_FileOperation.to_rename->str, &ext);
1536 mf_debug("ext is %s", ext);
1537 if (ext && strlen(ext) != 0) {
1539 name_without_ext[strlen(name_without_ext) - strlen(ext) - 1] = '\0';
1540 ap->mf_FileOperation.file_name_suffix = strdup(ext);
1541 mf_debug("name_without_ext is [%s]\n", name_without_ext);
1542 if (strlen(name_without_ext)) {
1543 guide_text = elm_entry_utf8_to_markup(ecore_file_file_get(name_without_ext));
1545 guide_text = elm_entry_utf8_to_markup(filename->str);
1548 guide_text = elm_entry_utf8_to_markup(filename->str);
1551 SAFE_FREE_CHAR(ext);
1552 SAFE_FREE_CHAR(name_without_ext);
1554 guide_text = elm_entry_utf8_to_markup(filename->str);
1557 if (ap->mf_FileOperation.file_name_suffix) {
1558 limit_filter_data.max_char_count = (MYFILE_FILE_NAME_LEN_MAX - mf_util_character_count_get(ap->mf_FileOperation.file_name_suffix) - 1);
1560 limit_filter_data.max_char_count = MYFILE_FILE_NAME_LEN_MAX;
1563 limit_filter_data.max_byte_count = 0;
1564 elm_entry_markup_filter_append(ap->mf_MainWindow.pEntry, elm_entry_filter_limit_size, &limit_filter_data);
1565 elm_entry_input_panel_return_key_type_set(ap->mf_MainWindow.pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
1567 elm_entry_entry_set(ap->mf_MainWindow.pEntry, guide_text);
1568 /*elm_entry_entry_set(entry, ecore_file_file_get(params->m_ItemName->str));*/
1569 elm_entry_cursor_end_set(entry);
1571 SAFE_FREE_CHAR(guide_text);
1572 SAFE_FREE_GSTRING(filename);
1574 evas_object_smart_callback_add(entry, "activated", mf_genlist_rename_done, params->ap);
1575 evas_object_smart_callback_add(entry, "maxlength,reached", mf_callback_max_len_reached_cb, params->ap);
1576 evas_object_smart_callback_add(entry, "preedit,changed",
1577 mf_callback_imf_preedit_change_cb, ap);
1578 mf_widget_imf_hide_callback_register(ap->mf_MainWindow.pConformant, entry);
1580 evas_object_show(entry);
1581 elm_object_focus_set(entry, EINA_TRUE);
1587 void mf_navi_bar_create_rename_view(void *data)
1591 mfItemData_s *params = (mfItemData_s *) data;
1593 struct appdata *ap = (struct appdata *)params->ap;
1594 mf_retm_if(ap == NULL, "ap is NULL");
1596 Evas_Object *newContent = NULL;
1598 Evas_Object *pNaviBar = NULL;
1599 GString *title = NULL;
1600 #ifdef MYFILE_SPLIT_VIEW
1601 if (ap->mf_Status.rotation_type == MF_ROTATE_LANDSCAPE) {
1602 mf_navi_bar_set_panes_navi_to_main(ap);
1606 myfileNaviBar *pNavi_s = mf_navi_bar_get_in_use(ap);
1607 mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
1609 pNaviBar = ap->mf_MainWindow.pNaviBar;
1610 SAFE_FREE_GSTRING(ap->mf_FileOperation.to_rename);
1612 ap->mf_FileOperation.to_rename = g_string_new((char *)params->m_ItemName->str);
1614 ap->mf_MainWindow.pNaviBox = NULL;
1615 ap->mf_MainWindow.pNaviLayout= NULL;
1617 ap->mf_MainWindow.pNaviBox = mf_widget_create_box(ap->mf_MainWindow.pNaviBar);
1618 newContent = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, GRP_NEW_FOLDER);
1619 __rename_entryfield_create(newContent, params);
1620 evas_object_size_hint_weight_set(newContent, EVAS_HINT_EXPAND, 0);
1621 evas_object_size_hint_align_set(newContent, EVAS_HINT_FILL, 0.0);
1622 Evas_Object *pad = mf_widget_create_layout(ap->mf_MainWindow.pNaviBox, EDJ_NAME, "PAD");
1623 elm_object_part_content_set(newContent, "content", ap->mf_MainWindow.pEditField);
1624 elm_box_pack_start(ap->mf_MainWindow.pNaviBox, newContent);
1625 elm_box_pack_end(ap->mf_MainWindow.pNaviBox, pad);
1627 title = g_string_new(GET_SYS_STR(LABEL_RENAME));
1629 if (title != NULL) {
1630 pNavi_s->pNaviTitle = g_strdup(title->str);
1631 g_string_free(title, TRUE);
1634 /*navigation view integration*/
1635 ap->mf_Status.pPreNaviItem = ap->mf_MainWindow.pNaviItem;
1636 mf_language_mgr_unregister_object_item_by_type(ITEM_TYPE_CTRL);
1637 ap->mf_MainWindow.pNaviItem = elm_naviframe_item_push(pNaviBar, NULL, NULL, NULL, ap->mf_MainWindow.pNaviBox, NULL);
1639 mf_navi_bar_title_set(ap);
1641 Evas_Object *l_bt = NULL;
1642 Evas_Object *r_bt = NULL;
1644 l_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1645 elm_object_focus_set(l_bt, EINA_FALSE);
1646 elm_object_style_set(l_bt, "naviframe/toolbar/default");
1647 elm_object_text_set(l_bt, GET_SYS_STR(LABEL_SAVE));
1648 mf_language_mgr_register_object(l_bt, OBJ_TYPE_ELM_OBJECT, NULL, LABEL_SAVE);
1649 evas_object_smart_callback_add(l_bt, "clicked", mf_callback_save_cb, ap);
1650 evas_object_show(l_bt);
1651 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, NAVI_BOTTOM_BUTTON_1_PART, l_bt);
1653 r_bt = elm_button_add(ap->mf_MainWindow.pNaviBar);
1654 elm_object_focus_set(r_bt, EINA_FALSE);
1655 elm_object_style_set(r_bt, "naviframe/end_btn/default");
1656 evas_object_smart_callback_add(r_bt, "clicked", mf_callback_cancel_cb, ap);
1657 evas_object_show(r_bt);
1659 mf_callback_imf_state_callback_register(ap);
1660 elm_object_item_part_content_set(ap->mf_MainWindow.pNaviItem, "prev_btn", r_bt);
1665 myfileNaviBar *mf_navi_bar_get_in_use(void *data)
1668 struct appdata *ap = (struct appdata *)data;
1669 mf_retvm_if(ap == NULL, NULL, "ap is NULL");
1670 Eina_List *plistNavi_s = ap->mf_MainWindow.plistNaviBar;
1671 mf_retvm_if(plistNavi_s == NULL, NULL, "plistNavi_s is NULL");
1673 myfileNaviBar *ret = NULL;
1674 Eina_List *l = NULL;
1677 EINA_LIST_FOREACH(plistNavi_s, l, item) {
1678 ret = (myfileNaviBar *) item;
1680 mf_retvm_if(ret == NULL, NULL, "item is NULL");
1682 if (ret->naviFlagInUse == TRUE) {
1692 myfileNaviBar *mf_navi_bar_get_edit_start(void *data)
1694 struct appdata *ap = (struct appdata *)data;
1696 Eina_List *plistNavi_s = ap->mf_MainWindow.plistNaviBar;
1697 assert(plistNavi_s);
1699 myfileNaviBar *ret = NULL;
1700 Eina_List *l = NULL;
1703 EINA_LIST_FOREACH(plistNavi_s, l, item) {
1704 ret = (myfileNaviBar *) item;
1705 if (ret->naviFlagEditStart == TRUE) {
1714 void mf_navi_bar_object_reset(myfileNaviBar *pNavi_s)
1716 mf_retm_if(pNavi_s == NULL, "Navi structure is NULL");
1717 pNavi_s->pNaviTitle = NULL;
1719 if (pNavi_s->pCurrentPath != NULL)
1720 free(pNavi_s->pCurrentPath);
1721 pNavi_s->pCurrentPath = NULL;
1723 if (pNavi_s->pNaviLabel != NULL)
1724 free(pNavi_s->pNaviLabel);
1725 pNavi_s->pNaviLabel = NULL;
1728 /******************************
1729 ** Prototype : mfNaviBarListItemRemove
1730 ** Description : remove the navi bar item from the list by label
1731 ** Input : void *data
1732 ** const char* pNaviLabel
1739 ** 1.Date : 2010/12/10
1741 ** Modification : Created function
1743 ******************************/
1744 bool mf_navi_bar_remove_list_item_by_label(void *data, const char *pNaviLabel)
1746 struct appdata *ap = (struct appdata *)data;
1747 mf_retvm_if(ap == NULL, false, "ap is NULL");
1748 mf_retvm_if(pNaviLabel == NULL, false, "Navi Bar Label is NULL");
1750 bool bEditStartFlag = FALSE;
1751 bool bInUseFlag = FALSE;
1753 myfileNaviBar *pNavi_s = mf_navi_bar_get_struct_by_label(ap, pNaviLabel);
1755 if (pNavi_s == NULL) {
1757 return bEditStartFlag;
1759 Eina_List *plistNavi = eina_list_data_find_list(ap->mf_MainWindow.plistNaviBar, pNavi_s);
1760 ap->mf_MainWindow.plistNaviBar = eina_list_remove_list(ap->mf_MainWindow.plistNaviBar, plistNavi);
1763 if (pNavi_s->naviFlagEditStart == TRUE) {
1764 bEditStartFlag = TRUE;
1766 if (pNavi_s->naviFlagInUse == TRUE) {
1770 mf_navi_bar_object_reset(pNavi_s);
1772 if (bInUseFlag == TRUE) {
1773 pNavi_s = (myfileNaviBar *) eina_list_nth(ap->mf_MainWindow.plistNaviBar, 0);
1774 pNavi_s->naviFlagInUse = TRUE;
1777 return bEditStartFlag;
1780 myfileNaviBar *mf_navi_bar_get_struct_by_label(void *data, const char *pNaviLabel)
1782 struct appdata *ap = (struct appdata *)data;
1783 mf_retvm_if(ap == NULL, NULL, "ap is NULL");
1784 mf_retvm_if(pNaviLabel == NULL, NULL, "Navi Bar Label is NULL");
1786 Eina_List *l = NULL;
1789 myfileNaviBar *ret = NULL;
1790 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
1791 if (g_strcmp0(((myfileNaviBar *) item)->pNaviLabel, pNaviLabel) == 0) {
1792 ret = (myfileNaviBar *) item;
1799 myfileNaviBar *mf_navi_bar_recover_list(void *data)
1802 struct appdata *ap = (struct appdata *)data;
1805 /*0 set state to be Default*/
1806 ap->mf_Status.more = MORE_DEFAULT;
1807 /*1 recover all the navigation bar*/
1808 Eina_List *l = NULL;
1810 myfileNaviBar *pNavi_s = NULL;
1811 myfileNaviBar *pNavi_toshow = NULL;
1812 bool flag_pop_todo = FALSE;
1813 EINA_LIST_FOREACH(ap->mf_MainWindow.plistNaviBar, l, item) {
1814 flag_pop_todo = TRUE;
1815 pNavi_s = (myfileNaviBar *) item;
1816 /*2.0 recover the pre_status*/
1817 pNavi_s->pre_more = ap->mf_Status.more;
1818 /*2.1 recover the path just before when edit click*/
1819 pNavi_s->pCurrentPath = g_strdup(pNavi_s->pre_operation.path->str);
1820 /*2.2 free the backup data structure*/
1821 g_string_free(pNavi_s->pre_operation.path, TRUE);
1822 pNavi_s->pre_operation.path = NULL;
1823 memset(&(pNavi_s->pre_operation), 0, sizeof(oper_record));
1824 /*2.3 set navi related status*/
1825 if (pNavi_s->naviFlagInUse == TRUE) {
1826 /*2.1-1 set pNavi_toshow for refreshing*/
1827 pNavi_toshow = pNavi_s;
1830 return pNavi_toshow;
1833 void mf_navi_bar_refresh_recovered_view(void *data, myfileNaviBar * pNaviStruct)
1836 struct appdata *ap = (struct appdata *)data;
1837 mf_retm_if(ap == NULL, "ap is NULL");
1838 mf_retm_if(pNaviStruct == NULL, "Navi Bar Struct is NULL");
1840 if (ap->mf_Status.path != NULL) {
1841 g_string_free(ap->mf_Status.path, TRUE);
1842 ap->mf_Status.path = NULL;
1844 ap->mf_Status.path = g_string_new(pNaviStruct->pCurrentPath);
1845 mf_debug("ap->mf_Status.path is [%s]", ap->mf_Status.path->str);
1848 mf_widget_refresh_view(ap);
1853 bool mf_navi_bar_is_navi_empty(void *data, char *label)
1855 struct appdata *ap = (struct appdata *)data;
1860 Elm_Object_Item *top_it= elm_naviframe_top_item_get(ap->mf_MainWindow.pNaviBar);
1861 Evas_Object *top_view = elm_object_item_content_get(top_it);
1863 if (top_view == NULL)
1869 void mf_navi_bar_transition_finished_cb(void *data, Evas_Object *obj, void *event_info)
1872 mf_retm_if(data == NULL, "data is NULL");
1873 mf_retm_if(obj == NULL, "obj is NULL");
1874 struct appdata *ap = (struct appdata *)data;
1875 Elm_Object_Item *it = ap->mf_Status.pPreNaviItem;
1877 SAFE_DEL_NAVI_ITEM(it);
1878 ap->mf_Status.pPreNaviItem = NULL;
1879 mf_widget_set_navi_blocking(ap, EINA_FALSE);
1880 evas_object_smart_callback_del(obj, "transition,finished", mf_navi_bar_transition_finished_cb);
1884 void mf_navi_bar_remove_previous_contents(void *data, Evas_Object *pNaviBar)
1887 mf_retm_if(data == NULL, "data is NULL");
1888 mf_retm_if(pNaviBar == NULL, "pNaviBar is NULL");
1889 struct appdata *ap = (struct appdata *)data;
1891 if (ap->mf_Status.pPreNaviItem != NULL) {
1892 mf_widget_set_navi_blocking(data, EINA_TRUE);
1893 evas_object_smart_callback_add(pNaviBar, "transition,finished", mf_navi_bar_transition_finished_cb, data);
1898 void mf_navi_bottom_item_del(Elm_Object_Item **pPreNaviItem)
1901 mf_retm_if(*pPreNaviItem == NULL, "pPreNaviItem is NULL");
1902 SAFE_DEL_NAVI_ITEM(*pPreNaviItem);
1903 *pPreNaviItem = NULL;
1907 myfileNaviBar *mf_navi_bar_get_navi_from_navilist(Eina_List *navilist, const char *label)
1911 mf_retvm_if(navilist == NULL, NULL, "navilist is NULL");
1912 mf_retvm_if(label == NULL, NULL, "label is NULL");
1915 myfileNaviBar *pNavi = NULL;
1916 Eina_List *l = NULL;
1917 EINA_LIST_FOREACH(navilist, l, data) {
1919 pNavi = (myfileNaviBar *)data;
1920 if (pNavi && pNavi->pNaviLabel && g_strcmp0(label, pNavi->pNaviLabel) == 0)
1930 void mf_navi_bar_del_item_directly(void *data)
1933 mf_retm_if(data == NULL, "data is NULL");
1934 struct appdata *ap = (struct appdata *)data;
1936 if (ap->mf_Status.flagNaviPush) {
1937 if(ap->mf_Status.pPreNaviItem)
1939 SAFE_DEL_NAVI_ITEM(ap->mf_Status.pPreNaviItem);
1940 mf_widget_set_navi_blocking(ap, EINA_FALSE);
1941 evas_object_smart_callback_del(ap->mf_MainWindow.pNaviBar, "transition,finished", mf_navi_bar_transition_finished_cb);
1946 void mf_navi_bar_button_set_disable(Elm_Object_Item *navi_it, int disable_item, bool disable)
1949 mf_retm_if(navi_it == NULL, "navi_it is NULL");
1950 Evas_Object *btn = NULL;
1951 if (disable_item & CTRL_DISABLE_EDIT) {
1952 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1953 const char *button_label = elm_object_text_get(btn);
1954 if (g_strcmp0(button_label, GET_SYS_STR(MF_LABEL_EDIT)) == 0)
1955 elm_object_disabled_set(btn, disable);
1958 if (disable_item & CTRL_DISABLE_DELETE) {
1959 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1960 const char *button_label = elm_object_text_get(btn);
1961 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_DELETE)) == 0)
1962 elm_object_disabled_set(btn, disable);
1965 if (disable_item & CTRL_DISABLE_SEND) {
1966 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1967 const char *button_label = elm_object_text_get(btn);
1968 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_SHARE)) == 0)
1969 elm_object_disabled_set(btn, disable);
1972 if (disable_item & CTRL_DISABLE_SEND) {
1973 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
1974 const char *button_label = elm_object_text_get(btn);
1975 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_SHARE)) == 0)
1976 elm_object_disabled_set(btn, disable);
1979 if (disable_item & CTRL_DISABLE_COPY_HERE) {
1980 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1981 const char *button_label = elm_object_text_get(btn);
1982 if (g_strcmp0(button_label, GET_STR(LABEL_COPY_HERE)) == 0)
1983 elm_object_disabled_set(btn, disable);
1986 if (disable_item & CTRL_DISABLE_MOVE_HERE) {
1987 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
1988 const char *button_label = elm_object_text_get(btn);
1989 if (g_strcmp0(button_label, GET_STR(LABEL_MOVE_HERE)) == 0)
1990 elm_object_disabled_set(btn, disable);
1993 if (disable_item & CTRL_DISABLE_CREATE) {
1994 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
1995 const char *button_label = elm_object_text_get(btn);
1996 if (g_strcmp0(button_label, GET_SYS_STR(MF_LABEL_CREATE_FOLDER)) == 0)
1997 elm_object_disabled_set(btn, disable);
1999 if (disable_item & CTRL_DISABLE_MORE) {
2000 btn = elm_object_item_part_content_get(navi_it, NAVI_MORE_BUTTON_PART);
2001 elm_object_disabled_set(btn, disable);
2004 if (disable_item & CTRL_DISABLE_SEARCH) {
2005 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
2006 elm_object_disabled_set(btn, disable);
2014 int mf_navi_bar_button_get_disable(Elm_Object_Item *navi_it)
2016 mf_retvm_if(navi_it == NULL, 0, "navi_it is NULL");
2017 int disable_item = 0;
2018 const char *button_label = NULL;
2020 Evas_Object *btn = NULL;
2021 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_1_PART);
2022 button_label = elm_object_text_get(btn);
2023 if(elm_object_disabled_get(btn)) {
2024 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_DELETE)) == 0) {
2025 disable_item |= CTRL_DISABLE_DELETE;
2029 btn = elm_object_item_part_content_get(navi_it, NAVI_BOTTOM_BUTTON_2_PART);
2030 button_label = elm_object_text_get(btn);
2031 if(elm_object_disabled_get(btn)) {
2032 if (g_strcmp0(button_label, GET_SYS_STR(LABEL_SHARE)) == 0) {
2033 disable_item |= CTRL_DISABLE_SEND;
2037 return disable_item;