merge with master
[apps/core/preloaded/myfiles.git] / src / widget / mf-popup.c
1 /*
2  * Copyright 2013         Samsung Electronics Co., Ltd
3  *
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
7  *
8  *  http://floralicense.org/license/
9  *
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.
15  */
16
17
18 #include <vconf-keys.h>
19 #include <syspopup_caller.h>
20 #include <bundle.h>
21 #include <status.h>
22
23 #include "mf-util.h"
24 #include "mf-widget.h"
25 #include "mf-fm-svc-wrapper.h"
26 #include "mf-callback.h"
27 #include "mf-language-mgr.h"
28
29 #define ITEM_COUNT      6
30 #define ITEM_MAX_COUNT  4
31 #define SHARE_ITEM_COUNT        4
32 #define MF_POPUP_STYLE_MIN_MENUSTYLE "menustyle"
33 #define MF_POPUP_MENUSTYLE_WIDTH (614*elm_config_scale_get())
34 #define MF_POPUP_MENUSTYLE_HEIGHT(x) ((113*x-1)*elm_config_scale_get())
35 #define MF_POPUP_MENUSTYLE_HEIGHT_MAX (408*elm_config_scale_get())
36 Elm_Genlist_Item_Class listby_itc, share_itc, storage_itc;
37
38 typedef struct {
39         int index;
40         bool unregister_lang_mgr;
41         Elm_Object_Item *item;
42         struct appdata *ap;
43 } ListByData_s;
44
45 static int __mf_popup_get_list_by_selected_item()
46 {
47         int iSortTypeValue = 0;
48         mf_util_get_vconf_value(VCONF_TYPE_SORT_TYPE, &iSortTypeValue);
49
50         int ret = -1;
51         switch (iSortTypeValue) {
52         case    MYFILE_SORT_BY_DATE_O2R:
53                 ret = 3;
54                 break;
55         case    MYFILE_SORT_BY_DATE_R2O:
56                 ret = 2;
57                 break;
58         case    MYFILE_SORT_BY_TYPE_A2Z:
59                 ret = 5;
60                 break;
61         case    MYFILE_SORT_BY_NAME_A2Z:
62                 ret = 0;
63                 break;
64         case    MYFILE_SORT_BY_NAME_Z2A:
65                 ret = 1;
66                 break;
67         case    MYFILE_SORT_BY_SIZE_L2S:
68                 ret = 4;
69                 break;
70         case    MYFILE_SORT_BY_SIZE_S2L:
71         case    MYFILE_SORT_BY_TYPE_Z2A:
72         default:
73                 ret = 0;
74                 break;
75         }
76         return ret;
77 }
78
79 static int __mf_popup_get_list_by_opt(int index)
80 {
81         //int iSortTypeValue = 0;
82         //mf_util_get_vconf_value(VCONF_TYPE_SORT_TYPE, &iSortTypeValue);
83
84         fsSortOption ret = MYFILE_SORT_BY_NONE;
85         switch (index) {
86         case 0:
87                 ret = MYFILE_SORT_BY_NAME_A2Z;
88                 break;
89         case 1:
90                 ret = MYFILE_SORT_BY_NAME_Z2A;
91                 break;
92         case 2:
93                 ret = MYFILE_SORT_BY_DATE_R2O;
94                 break;
95         case 3:
96                 ret = MYFILE_SORT_BY_DATE_O2R;
97                 break;
98         case 4:
99                 ret = MYFILE_SORT_BY_SIZE_L2S;
100                 break;
101         case 5:
102                 ret = MYFILE_SORT_BY_TYPE_A2Z;
103                 break;
104         default:
105                 ret = MYFILE_SORT_BY_DATE_R2O;
106                 break;
107         }
108         return ret;
109 }
110
111 static int __mf_popup_get_view_as_type(int index)
112 {
113         eMfViewStyle ret = MF_VIEW_STYLE_LIST;
114         switch (index) {
115         case 0:
116                 ret = MF_VIEW_STYLE_LIST;
117                 break;
118         case 1:
119                 ret = MF_VIEW_SYTLE_LIST_DETAIL;
120                 break;
121         case 2:
122                 ret = MF_VIEW_STYLE_THUMBNAIL;
123                 break;
124         default:
125                 ret = MF_VIEW_STYLE_LIST;
126                 break;
127         }
128         return ret;
129 }
130
131 static void __mf_popup_listby_genlist_del(void *data, Evas_Object * obj)
132 {
133         MF_TRACE_BEGIN;
134         ListByData_s *params = (ListByData_s *) data;
135         mf_retm_if(params == NULL, "params is NULL");
136
137         if(params->unregister_lang_mgr)
138                 mf_language_mgr_unregister_genlist_item(params->item);
139         SAFE_FREE_CHAR(params);
140 }
141
142 static char *__mf_popup_get_genlist_label(void *data, Evas_Object * obj, const char *part)
143 {
144         ListByData_s *params = (ListByData_s *) data;
145         assert(params);
146         struct appdata *ap = params->ap;
147         assert(ap);
148         assert(part);
149
150         char *ret = NULL;
151         if (!strcmp(part, "elm.text")) {
152                 //listby_opt = __mf_popup_get_list_by_opt(params->index);
153                 switch (params->index) {
154                 case 0:
155                         ret = g_strdup(GET_STR(MF_LABEL_NAME_HA_TO_Z));
156                         break;
157                 case 1:
158                         ret = g_strdup(GET_STR(MF_LABEL_NAME_HZ_TO_A));
159                         break;
160                 case 2:
161                         ret = g_strdup(GET_STR(MF_LABEL_DATE_HMOST_RECENT));
162                         break;
163                 case 3:
164                         ret = g_strdup(GET_STR(MF_LABEL_DATE_HOLDEST));
165                         break;
166                 case 4:
167                         ret = g_strdup(GET_SYS_STR(MF_LABEL_SIZE));
168                         break;
169                 case 5:
170                         ret = g_strdup(GET_SYS_STR(MF_LABEL_TYPE));                   /**< Sort by file size descending */
171                         break;
172                 #if 0
173                 case MYFILE_SORT_BY_DATE_R2O:                         /**< Sort by file date descending */
174                         ret = g_strdup(GET_SYS_STR(MF_LABEL_DATE));
175                         break;
176                 case MYFILE_SORT_BY_TYPE_Z2A:                           /**< Sort by file type descending */
177                         ret = g_strdup(GET_SYS_STR(MF_LABEL_TYPE));
178                         break;
179                 #endif
180                 default:
181                         break;
182                 }
183                 return ret;
184         }
185         return NULL;
186 }
187
188 static char *__mf_popup_view_as_genlist_label_get(void *data, Evas_Object * obj, const char *part)
189 {
190         ListByData_s *params = (ListByData_s *) data;
191         assert(params);
192         struct appdata *ap = params->ap;
193         assert(ap);
194         assert(part);
195
196         eMfViewStyle view_as_type = MF_VIEW_STYLE_LIST;
197
198         char *ret = NULL;
199         if (!strcmp(part, "elm.text")) {
200                 view_as_type = __mf_popup_get_view_as_type(params->index);
201                 switch (view_as_type) {
202                 case MF_VIEW_STYLE_LIST:                              /**< Sort by file name ascending */
203                         ret = g_strdup(GET_SYS_STR(MF_LABEL_LIST));
204                         break;
205                 case MF_VIEW_SYTLE_LIST_DETAIL:                       /**< Sort by file size ascending */
206                         ret = g_strdup(GET_STR(LABEL_LIST_DETAIL_VIEW));
207                         break;
208                 case MF_VIEW_STYLE_THUMBNAIL:                         /**< Sort by file date ascending */
209                         ret = g_strdup(GET_STR(MF_LABEL_THUMBNAILS));
210                         break;
211                 default:
212                         break;
213                 }
214                 return ret;
215         }
216         return NULL;
217 }
218
219 static Evas_Object* __mf_popup_get_genlist_icon(void *data, Evas_Object * obj, const char *part)
220 {
221         ListByData_s *params = (ListByData_s *) data;
222         assert(params);
223         struct appdata *ap = params->ap;
224         assert(ap);
225         assert(part);
226
227         if (!strcmp(part, "elm.icon")) {
228                 Evas_Object *radio = NULL;
229                 radio = elm_radio_add(obj);
230                 elm_object_focus_set(radio, EINA_FALSE);
231                 elm_radio_state_value_set(radio, params->index);
232                 elm_radio_group_add(radio, ap->mf_Status.pRadioGroup);
233                 elm_radio_value_set(radio, ap->mf_Status.iRadioValue);
234                 evas_object_show(radio);
235                 return radio;
236         }
237         return NULL;
238 }
239
240 static void __mf_popup_genlist_select(void *data, Evas_Object * obj, void *event_info)
241 {
242         assert(data);
243         assert(event_info);
244         ListByData_s *params = NULL;
245         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
246
247         if (item != NULL) {
248
249                 elm_genlist_item_selected_set(item, FALSE);
250                 params = (ListByData_s *) elm_object_item_data_get(item);
251                 if (params != NULL && params->ap != NULL) {
252                         fsSortOption iListBySortType = MYFILE_SORT_BY_NONE;
253                         params->ap->mf_Status.iSelectedSortType = params->index;
254                         elm_radio_value_set(params->ap->mf_Status.pRadioGroup, params->index);
255                         iListBySortType = __mf_popup_get_list_by_opt(params->index);
256                         mf_util_set_sort_type(iListBySortType);
257                         mf_callback_list_by_response_cb(params->ap);
258                 }
259         }
260 }
261
262
263 static void __mf_popup_view_as_genlist_select(void *data, Evas_Object * obj, void *event_info)
264 {
265         assert(data);
266         assert(event_info);
267         ListByData_s *params = NULL;
268         int iViewAsType = 0;
269         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
270         if (item != NULL) {
271                 params = (ListByData_s *) elm_object_item_data_get(item);
272                 if (params != NULL && params->ap != NULL) {
273                         elm_radio_value_set(params->ap->mf_Status.pRadioGroup, params->index);
274                         iViewAsType = __mf_popup_get_view_as_type(params->index);
275                         params->ap->mf_Status.flagViewType = iViewAsType;
276                         mf_util_set_view_style(iViewAsType);
277                         mf_callback_popup_del_idler_cb(params->ap);
278                         if (params->ap->mf_Status.flagNoContent != EINA_TRUE) {
279                                 mf_widget_refresh_view(params->ap);
280                         }
281                 }
282         }
283 }
284 static int __mf_popup_get_view_as_selected_item()
285 {
286         int iViewAs = 0;
287
288         mf_util_get_vconf_value(VCONF_TYPE_VIEW_STYLE, &iViewAs);
289
290         int ret = -1;
291         switch (iViewAs) {
292         case    MF_VIEW_STYLE_LIST:
293                 ret = 0;
294                 break;
295         case    MF_VIEW_SYTLE_LIST_DETAIL:
296                 ret = 1;
297                 break;
298         case    MF_VIEW_STYLE_THUMBNAIL:
299                 ret = 2;
300                 break;
301         default:
302                 ret = 0;
303                 break;
304         }
305         return ret;
306 }
307
308 #ifdef MYFILE_SPLIT_VIEW
309 static void __mf_popup_storage_genlist_del(void *data, Evas_Object * obj)
310 {
311         MF_TRACE_BEGIN;
312         StorageData_s *params = (StorageData_s *) data;
313         mf_retm_if(params == NULL, "params is NULL");
314
315         if(params->unregister_lang_mgr)
316                 mf_language_mgr_unregister_genlist_item(params->item);
317         SAFE_FREE_CHAR(params->label);
318         SAFE_FREE_CHAR(params);
319 }
320
321 static char *__mf_popup_get_storage_genlist_label(void *data, Evas_Object * obj, const char *part)
322 {
323         MF_TRACE_BEGIN;
324         StorageData_s *params = (StorageData_s *) data;
325         mf_retvm_if(params == NULL, NULL, "params is NULL");
326         struct appdata *ap = params->ap;
327         mf_retvm_if(ap == NULL, NULL, "ap is NULL");
328         assert(part);
329
330         if (!strcmp(part, "elm.text")) {
331                 MF_TRACE_END;
332                 return strdup(params->label);
333         }
334         MF_TRACE_END;
335         return NULL;
336 }
337
338 static Evas_Object* __mf_popup_get_storage_genlist_icon(void *data, Evas_Object * obj, const char *part)
339 {
340         MF_TRACE_BEGIN;
341         StorageData_s *params = (StorageData_s *) data;
342         mf_retvm_if(params == NULL, NULL, "params is NULL");
343         struct appdata *ap = params->ap;
344         mf_retvm_if(ap == NULL, NULL, "ap is NULL");
345         assert(part);
346
347         if (!strcmp(part, "elm.icon")) {
348                 Evas_Object *radio = NULL;
349                 radio = elm_radio_add(obj);
350                 elm_object_focus_set(radio, EINA_FALSE);
351                 elm_radio_state_value_set(radio, params->index);
352                 elm_radio_group_add(radio, ap->mf_Status.pRadioGroup);
353                 elm_radio_value_set(radio, ap->mf_Status.iRadioValue);
354                 evas_object_show(radio);
355                 MF_TRACE_END;
356                 return radio;
357         }
358         MF_TRACE_END;
359         return NULL;
360 }
361
362 static void __mf_popup_storage_genlist_select(void *data, Evas_Object * obj, void *event_info)
363 {
364         MF_TRACE_BEGIN;
365         mf_retm_if(data == NULL, "data is NULL");
366         mf_retm_if(event_info == NULL, "event_info is NULL");
367         StorageData_s *params = NULL;
368         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
369         if (item != NULL) {
370                 params = (StorageData_s *) elm_object_item_data_get(item);
371                 if (params != NULL && params->ap != NULL) {
372                 }
373         }
374 }
375 #endif
376 /******************************
377 ** Prototype    : mf_popup_create_pb_popup
378 ** Description  :
379 ** Input        : void *data
380 **                char *context
381 **                int file_count
382 **                void*func
383 **                void* param
384 ** Output       : None
385 ** Return Value :
386 ** Calls        :
387 ** Called By    :
388 **
389 **  History        :
390 **  1.Date         : 2010/12/10
391 **    Author       : Samsung
392 **    Modification : Created function
393 **
394 ******************************/
395 Evas_Object *mf_popup_create_pb_popup(void *data, char *context, int file_count, void *func, void *param)
396 {
397
398         struct appdata *ap;
399
400         ap = (struct appdata *)data;
401         assert(ap);
402
403         char count[256] = { 0 };
404         Evas_Object *popup, *progressbar;
405         Evas_Object *layout;
406
407         snprintf(count, sizeof(count), "%s0/%d", count, file_count);
408
409         popup = elm_popup_add(ap->mf_MainWindow.pMainLayout);
410         elm_object_focus_set(popup, EINA_FALSE);
411
412         layout = elm_layout_add(popup);
413         elm_object_focus_set(layout, EINA_FALSE);
414         elm_layout_file_set(layout, EDJ_NAME, "popup_center_progressview");
415         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
416         ap->mf_MainWindow.pProgressLayout = layout;
417
418         progressbar = elm_progressbar_add(popup);
419         elm_object_focus_set(progressbar, EINA_FALSE);
420         ap->mf_FileOperation.progress_bar = progressbar;
421         elm_object_style_set(progressbar, "list_progress");
422         elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
423         evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
424         evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
425         elm_progressbar_value_set(progressbar, 0.0);
426         evas_object_show(progressbar);
427
428         elm_object_part_content_set(layout, "elm.swallow.content", progressbar);
429         edje_object_part_text_set(elm_layout_edje_get(layout), "elm.title", context);
430         edje_object_part_text_set(elm_layout_edje_get(layout), "elm.text.left", "0%");
431         edje_object_part_text_set(elm_layout_edje_get(layout), "elm.text.right", count);
432
433         elm_object_content_set(popup, layout);
434
435         Evas_Object *btn1 = mf_widget_button_create(popup, GET_SYS_STR(LABEL_CANCEL));
436         elm_object_style_set(btn1, "popup_button/default");
437         evas_object_smart_callback_add(btn1, "clicked", func, param);
438         elm_object_part_content_set(popup, "button1", btn1);
439
440         evas_object_show(popup);
441
442         return popup;
443 }
444
445 /******************************
446 ** Prototype    : mf_popup_create_popup
447 ** Description  :
448 ** Input        : void *data
449 **                ePopMode popupMode
450 **                char *title
451 **                char *context
452 **                char *first_btn_text
453 **                char *second_btn_text
454 **                char *third_btn_text
455 **                Evas_Smart_Cb func
456 **                void* param
457 ** Output       : None
458 ** Return Value :
459 ** Calls        :
460 ** Called By    :
461 **
462 **  History        :
463 **  1.Date         : 2010/12/10
464 **    Author       : Samsung
465 **    Modification : Created function
466 **
467 ******************************/
468 #ifdef MYFILE_SPLIT_VIEW
469 static void mf_popup_storage_item_append(void *data, Evas_Object *popup, Evas_Object *genlist)
470 {
471         MF_TRACE_BEGIN;
472         mf_retm_if(data == NULL, "data is NULL");
473         mf_retm_if(popup == NULL, "popup is NULL");
474         mf_retm_if(genlist == NULL, "genlist is NULL");
475
476         struct appdata *ap = (struct appdata *)data;
477         Elm_Object_Item *it = NULL;
478
479         StorageData_s *item_data = malloc(sizeof(StorageData_s));
480         if (item_data == NULL) {
481                 mf_util_operation_alloc_failed(ap);
482                 MF_TRACE_END;
483                 return;
484         }
485
486         item_data->label= strdup(GET_SYS_STR(MF_LABEL_PHONE));
487         item_data->index = MYFILE_PHONE;
488
489         item_data->unregister_lang_mgr = TRUE;
490         item_data->ap = ap;
491         it = elm_genlist_item_append(genlist, &storage_itc, (void *)item_data, NULL,
492                                      ELM_GENLIST_ITEM_NONE, __mf_popup_storage_genlist_select, popup);
493         item_data->item = it;
494         mf_language_mgr_register_genlist_item(it);
495
496         if (ap->mf_Status.iStorageState & MYFILE_MMC) {
497                 StorageData_s *item_data = malloc(sizeof(StorageData_s));
498                 if (item_data == NULL) {
499                         mf_util_operation_alloc_failed(ap);
500                         MF_TRACE_END;
501                         return;
502                 }
503                 item_data->label = strdup(GET_SYS_STR(MF_LABEL_MMC));
504                 mf_debug("item_data->label is [%s]", item_data->label);
505                 item_data->index = MYFILE_MMC;
506                 item_data->ap = ap;
507                 it = elm_genlist_item_append(genlist, &storage_itc, (void *)item_data, NULL,
508                                              ELM_GENLIST_ITEM_NONE, __mf_popup_storage_genlist_select, popup);
509                 item_data->item = it;
510                 mf_language_mgr_register_genlist_item(it);
511         }
512         if (ap->mf_Status.iStorageState & MYFILE_OTG) {
513                 StorageData_s *item_data = malloc(sizeof(StorageData_s));
514                 if (item_data == NULL) {
515                         mf_util_operation_alloc_failed(ap);
516                         MF_TRACE_END;
517                         return;
518                 }
519                 item_data->label = strdup(GET_STR(MF_LABEL_OTG));
520                 mf_debug("item_data->label is [%s]", item_data->label);
521                 item_data->index = MYFILE_OTG;
522                 item_data->ap = ap;
523                 it = elm_genlist_item_append(genlist, &storage_itc, (void *)item_data, NULL,
524                                              ELM_GENLIST_ITEM_NONE, __mf_popup_storage_genlist_select, popup);
525                 item_data->item = it;
526                 mf_language_mgr_register_genlist_item(it);
527         }
528         MF_TRACE_END;
529 }
530 #endif
531
532
533 static Evas_Object *__mf_popup_box_set(Evas_Object *parent, Evas_Object *content, int item_cnt)
534 {
535         mf_retvm_if(parent == NULL, NULL, "parent is NULL");
536         mf_retvm_if(content == NULL, NULL, "content is NULL");
537         mf_retvm_if(item_cnt < 0, NULL, "content is NULL");
538
539         Evas_Object *box = elm_box_add(parent);
540         if (item_cnt > ITEM_MAX_COUNT) {
541                 evas_object_size_hint_min_set(box, MF_POPUP_MENUSTYLE_WIDTH,
542                                               MF_POPUP_MENUSTYLE_HEIGHT(ITEM_MAX_COUNT));
543         } else {
544                 evas_object_size_hint_min_set(box, MF_POPUP_MENUSTYLE_WIDTH,
545                                               MF_POPUP_MENUSTYLE_HEIGHT(item_cnt));
546         }
547
548         evas_object_show(content);
549         elm_box_pack_end(box, content);
550         return box;
551 }
552
553 Evas_Object *mf_ug_popup_create_search(void *data, Evas_Smart_Cb func, void *param)
554 {
555         MF_TRACE_BEGIN;
556         struct appdata *ap = (struct appdata *)data;
557         mf_retvm_if(ap == NULL, NULL, "ap is NULL");
558
559
560         Evas_Object *popup;
561         Evas_Object *layout;
562         Evas_Object *label = NULL;
563
564
565         popup = elm_popup_add(ap->mf_MainWindow.pMainLayout);
566         elm_object_focus_set(popup, EINA_FALSE);
567
568         layout = elm_layout_add(popup);
569         elm_object_focus_set(layout, EINA_FALSE);
570         elm_layout_file_set(layout, EDJ_NAME, "popup_center_text");
571         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
572         ap->mf_MainWindow.pSearchLabel = layout;
573
574         elm_object_part_text_set(layout, "elm.swallow.content", "Phone");
575         elm_object_part_text_set(layout, "elm.title", mf_util_get_text(MF_LABEL_SEARCHING));
576
577         elm_object_content_set(popup, layout);
578
579         Evas_Object *btn1 = mf_widget_button_create(popup, GET_SYS_STR(LABEL_CANCEL));
580         elm_object_style_set(btn1, "popup_button/default");
581         evas_object_smart_callback_add(btn1, "clicked", func, param);
582         elm_object_part_content_set(popup, "button1", btn1);
583
584         evas_object_show(popup);
585
586         return popup;
587 }
588
589 Evas_Object *mf_popup_create_popup(void *data, ePopMode popupMode, char *title, const char *context, const char *first_btn_text, const char *second_btn_text,
590                                    const char *third_btn_text, Evas_Smart_Cb func, void *param)
591 {
592         mf_debug();
593         Evas_Object *popup;
594         struct appdata *ap;
595         Evas_Object *genlist;
596         Evas_Object *radio_group = NULL;
597         Evas_Object *box = NULL;
598         Evas_Object *btn1 = NULL;
599         Evas_Object *btn2 = NULL;
600         Evas_Object *btn3 = NULL;
601         int index = 0;
602         int listby_selected= 0;
603         int context_items = 0;
604 #ifdef MYFILE_SPLIT_VIEW
605         int storage = MYFILE_PHONE;
606 #endif
607         ap = (struct appdata *)data;
608         mf_retvm_if(ap == NULL, NULL, "ap is NULL");
609
610         popup = elm_popup_add(ap->mf_MainWindow.pWindow);
611         elm_object_focus_set(popup, EINA_FALSE);
612         evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
613         if (title) {
614                 elm_object_part_text_set(popup, "title,text", title);
615                 mf_language_mgr_register_object(popup, OBJ_TYPE_EDJE_OBJECT, "title,text", title);
616         }
617         if (context && popupMode != POPMODE_PROGRESSBAR) {
618                 mf_debug();
619                 elm_object_text_set(popup, context);
620         }
621
622         switch (popupMode) {
623         case POPMODE_TEXT:
624         case POPMODE_TITLE_TEXT:
625                 elm_popup_timeout_set(popup, 3);
626                 if (func != NULL) {
627                         evas_object_smart_callback_add(popup, "response", func, param);
628                 }
629                 break;
630         case POPMODE_TEXT_NOT_DISABLED:
631                 if (func != NULL) {
632                         evas_object_smart_callback_add(popup, "response", func, NULL);
633                 }
634                 break;
635
636         case POPMODE_TEXT_TWO_BTN:
637         case POPMODE_TITLE_TEXT_TWO_BTN:
638                 btn1 = mf_widget_button_create(popup, first_btn_text);
639                 elm_object_style_set(btn1, "popup_button/default");
640                 btn2 = mf_widget_button_create(popup, second_btn_text);
641                 elm_object_style_set(btn2, "popup_button/default");
642                 if (g_strcmp0(GET_SYS_STR(LABEL_DELETE), first_btn_text) == 0) {
643                         elm_object_style_set(btn1, "sweep/delete");
644                         elm_object_style_set(btn2, "sweep/multiline");
645                 }
646                 evas_object_smart_callback_add(btn1, "clicked", func, param);
647                 evas_object_smart_callback_add(btn2, "clicked", func, param);
648                 elm_object_part_content_set(popup, "button1", btn1);
649                 elm_object_part_content_set(popup, "button2", btn2);
650                 break;
651
652         case POPMODE_TEXT_BTN:
653         case POPMODE_TITLE_TEXT_BTN:
654                 btn1 = mf_widget_button_create(popup, GET_SYS_STR(MF_BUTTON_LABEL_OK));
655                 elm_object_style_set(btn1, "popup_button/default");
656                 evas_object_smart_callback_add(btn1, "clicked", func, param);
657                 elm_object_part_content_set(popup, "button1", btn1);
658                 break;
659         case POPMODE_TITLE_TEXT_THREE_BTN:
660
661                 elm_object_style_set(popup, "verticalbuttonstyle");
662                 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
663
664                 btn1 = mf_widget_button_create(popup, GET_SYS_STR(MF_LABEL_REPLACE));
665                 elm_object_style_set(btn1, "popup_button/default");
666                 btn2 = mf_widget_button_create(popup, GET_STR(MF_BUTTON_LABEL_RENAME_AUTOMATICALLY));
667                 elm_object_style_set(btn2, "popup_button/default");
668                 btn3 = mf_widget_button_create(popup, GET_SYS_STR(LABEL_CANCEL));
669                 elm_object_style_set(btn3, "popup_button/default");
670
671                 evas_object_smart_callback_add(btn1, "clicked", mf_callback_operation_request_replace_cb, param);
672                 evas_object_smart_callback_add(btn2, "clicked", mf_callback_operation_request_rename_cb, param);
673                 evas_object_smart_callback_add(btn3, "clicked", mf_callback_operation_request_cancel_cb, param);
674                 elm_object_part_content_set(popup, "button1", btn1);
675                 elm_object_part_content_set(popup, "button2", btn2);
676                 elm_object_part_content_set(popup, "button3", btn3);
677                 break;
678
679         case POPMODE_TITLE_LIST_BTN:
680
681                 elm_object_style_set(popup, MF_POPUP_STYLE_MIN_MENUSTYLE);
682
683                 btn1 = mf_widget_button_create(popup, GET_SYS_STR(LABEL_CANCEL));
684                 elm_object_style_set(btn1, "popup_button/default");
685                 evas_object_smart_callback_add(btn1, "clicked", func, param);
686                 elm_object_part_content_set(popup, "button1", btn1);
687
688                 //btn2 = mf_widget_button_create(popup, GET_STR(MF_LABEL_DESCENDING));
689                 //elm_object_style_set(btn2, "popup_button/default");
690                 //evas_object_smart_callback_add(btn2, "clicked", func, param);
691                 //elm_object_part_content_set(popup, "button2", btn2);
692
693                 if (ap->mf_Status.pRadioGroup) {
694                         evas_object_del(ap->mf_Status.pRadioGroup);
695                         ap->mf_Status.pRadioGroup = NULL;
696                 }
697
698                 radio_group = elm_radio_add(ap->mf_MainWindow.pWindow);
699                 elm_object_focus_set(radio_group, EINA_FALSE);
700                 elm_radio_value_set(radio_group, 0);
701                 evas_object_hide(radio_group);
702                 ap->mf_Status.pRadioGroup = radio_group;
703
704                 listby_selected = __mf_popup_get_list_by_selected_item();
705                 ap->mf_Status.iRadioValue = listby_selected;
706
707                 listby_itc.item_style = "1text.1icon.2";
708                 listby_itc.func.text_get = __mf_popup_get_genlist_label;
709                 listby_itc.func.content_get = __mf_popup_get_genlist_icon;
710                 listby_itc.func.state_get = NULL;
711                 listby_itc.func.del = __mf_popup_listby_genlist_del;
712                 genlist = elm_genlist_add(popup);
713                 //elm_genlist_homogeneous_set(genlist, EINA_TRUE);
714                 elm_object_focus_set(genlist, EINA_FALSE);
715                 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
716                 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
717                 for (index = 0; index < ITEM_COUNT; index++) {
718                         Elm_Object_Item *it = NULL;
719                         ListByData_s *item_data = malloc(sizeof(ListByData_s));
720                         if (item_data == NULL)
721                                 continue;
722
723                         item_data->index = index;
724                         item_data->unregister_lang_mgr = TRUE;
725                         item_data->ap = ap;
726                         it = elm_genlist_item_append(genlist, &listby_itc, (void *)item_data, NULL,
727                                                      ELM_GENLIST_ITEM_NONE, __mf_popup_genlist_select, popup);
728
729                         item_data->item = it;
730                         mf_language_mgr_register_genlist_item(it);
731                 }
732
733                 box = __mf_popup_box_set(popup, genlist, ITEM_COUNT);
734                 elm_object_content_set(popup, box);
735                 evas_object_smart_callback_add(popup, "response", func, param);
736                 break;
737         case POPMODE_VIEW_AS_LIST:
738                 elm_object_style_set(popup, MF_POPUP_STYLE_MIN_MENUSTYLE);
739
740                 btn1 = mf_widget_button_create(popup, GET_SYS_STR(LABEL_CANCEL));
741                 elm_object_style_set(btn1, "popup_button/default");
742                 evas_object_smart_callback_add(btn1, "clicked", func, param);
743                 elm_object_part_content_set(popup, "button1", btn1);
744
745                 if (ap->mf_Status.pRadioGroup) {
746                         evas_object_del(ap->mf_Status.pRadioGroup);
747                         ap->mf_Status.pRadioGroup = NULL;
748                 }
749
750                 radio_group = elm_radio_add(ap->mf_MainWindow.pWindow);
751                 elm_object_focus_set(radio_group, EINA_FALSE);
752                 elm_radio_value_set(radio_group, 0);
753                 evas_object_hide(radio_group);
754                 ap->mf_Status.pRadioGroup = radio_group;
755
756                 listby_selected = __mf_popup_get_view_as_selected_item();
757                 ap->mf_Status.iRadioValue = listby_selected;
758
759                 listby_itc.item_style = "1text.1icon.2";
760                 listby_itc.func.text_get = __mf_popup_view_as_genlist_label_get;
761                 listby_itc.func.content_get = __mf_popup_get_genlist_icon;
762                 listby_itc.func.state_get = NULL;
763                 listby_itc.func.del = __mf_popup_listby_genlist_del;
764                 genlist = elm_genlist_add(popup);
765                 //elm_genlist_homogeneous_set(genlist, EINA_TRUE);
766                 elm_object_focus_set(genlist, EINA_FALSE);
767                 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
768                 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
769                 for (index = 0; index < 3; index++) {
770                         Elm_Object_Item *it = NULL;
771                         ListByData_s *item_data = malloc(sizeof(ListByData_s));
772                         if (item_data == NULL)
773                                 continue;
774
775                         item_data->index = index;
776                         item_data->unregister_lang_mgr = TRUE;
777                         item_data->ap = ap;
778                         it = elm_genlist_item_append(genlist, &listby_itc, (void *)item_data, NULL,
779                                                      ELM_GENLIST_ITEM_NONE, __mf_popup_view_as_genlist_select, popup);
780                         item_data->item = it;
781                         mf_language_mgr_register_genlist_item(it);
782                 }
783
784                 box = __mf_popup_box_set(popup, genlist, 3);
785                 elm_object_content_set(popup, box);
786                 evas_object_smart_callback_add(popup, "response", func, param);
787         default:
788                 break;
789         }
790         evas_object_show(popup);
791         return popup;
792 }
793
794 void mf_popup_indicator_popup(void *data, const char *text)
795 {
796         mf_retm_if(text == NULL, "text is NULL");
797         int ret = status_message_post(text);
798         mf_debug("status_message_post()... [0x%x]!", ret);
799         if (ret != 0) {
800                 mf_debug("status_message_post()... [0x%x]!", ret);
801         } else {
802
803         }
804         return ;
805
806 }