Remove share function in history and bookmarks menu
[profile/ivi/org.tizen.browser.git] / src / browser-history / browser-history-layout.cpp
index 540e46a..db25534 100755 (executable)
@@ -61,6 +61,7 @@ Browser_History_Layout::Browser_History_Layout(void)
        ,m_processing_popup_layout(NULL)
        ,m_processing_progress_bar(NULL)
        ,m_select_all_check_value(EINA_FALSE)
+       ,m_sub_main_history_layout(NULL)
        ,m_searchbar_layout(NULL)
        ,m_searched_history_genlist(NULL)
        ,m_no_content_search_result(NULL)
@@ -74,7 +75,7 @@ Browser_History_Layout::Browser_History_Layout(void)
 Browser_History_Layout::~Browser_History_Layout(void)
 {
        BROWSER_LOGD("[%s]", __func__);
-       hide_notify_popup();
+       hide_notify_popup_layout(m_sub_main_history_layout);
 
        for(int i = 0 ; i < m_history_list.size() ; i++ ) {
                if (m_history_list[i])
@@ -258,6 +259,8 @@ void Browser_History_Layout::__search_delay_changed_cb(void *data, Evas_Object *
                return;
 
        Browser_History_Layout *history_layout = (Browser_History_Layout *)data;
+       if (!elm_entry_is_empty(obj))
+               elm_object_signal_emit(history_layout->m_searchbar, "elm,state,guidetext,hide", "elm");
        if (!history_layout->_show_searched_history(utf8_text))
                BROWSER_LOGE("_show_searched_history failed");
 
@@ -330,11 +333,14 @@ void Browser_History_Layout::_set_edit_mode(Eina_Bool edit_mode)
        BROWSER_LOGD("[%s]", __func__);
        Browser_Bookmark_View *bookmark_view = m_data_manager->get_bookmark_view();
 
-       hide_notify_popup();
+       hide_notify_popup_layout(m_sub_main_history_layout);
 
        _enable_searchbar_layout(!edit_mode);
 
        if (edit_mode) {
+#if defined(GENLIST_SWEEP)
+               br_elm_genlist_sweep_item_recover(m_history_genlist);
+#endif
                elm_object_style_set(m_bg, "edit_mode");
 
                m_edit_mode_select_all_layout = elm_layout_add(m_content_box);
@@ -453,13 +459,13 @@ void Browser_History_Layout::_show_selection_info(void)
 
        if (selected_count == 0) {
                elm_object_item_disabled_set(m_data_manager->get_bookmark_view()->m_bookmark_delete_controlbar_item, EINA_TRUE);
-               hide_notify_popup();
+               hide_notify_popup_layout(m_sub_main_history_layout);
                return;
        } else
                elm_object_item_disabled_set(m_data_manager->get_bookmark_view()->m_bookmark_delete_controlbar_item, EINA_FALSE);
 
        if (selected_count == 1) {
-               show_notify_popup(BR_STRING_ONE_ITEM_SELECTED, 0, EINA_TRUE);
+               show_notify_popup_layout(BR_STRING_ONE_ITEM_SELECTED, 0, m_sub_main_history_layout);
        } else if (selected_count > 1) {
                char *small_popup_text = NULL;
                int string_len = strlen(BR_STRING_ITEMS_SELECTED) + 1;
@@ -468,7 +474,7 @@ void Browser_History_Layout::_show_selection_info(void)
                memset(small_popup_text, 0x00, string_len);
 
                snprintf(small_popup_text, string_len, BR_STRING_ITEMS_SELECTED, selected_count);
-               show_notify_popup(small_popup_text, 0, EINA_TRUE);
+               show_notify_popup_layout(small_popup_text, 0, m_sub_main_history_layout);
 
                if (small_popup_text)
                        free(small_popup_text);
@@ -1137,7 +1143,22 @@ Eina_Bool Browser_History_Layout::_create_main_layout(void)
        BROWSER_LOGD("[%s]", __func__);
        elm_object_style_set(m_bg, "default");  
 
-       m_searchbar_layout = elm_layout_add(m_navi_bar);
+       m_sub_main_history_layout = elm_layout_add(m_navi_bar);
+       if (!m_sub_main_history_layout) {
+               BROWSER_LOGE("elm_layout_add failed");
+               return EINA_FALSE;
+       }
+       elm_layout_file_set(m_sub_main_history_layout,
+                               BROWSER_EDJE_DIR"/browser-bookmark-view.edj",
+                               "browser/selectioninfo");
+       evas_object_size_hint_weight_set(
+                               m_sub_main_history_layout,
+                               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(
+                               m_sub_main_history_layout,
+                               EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       m_searchbar_layout = elm_layout_add(m_sub_main_history_layout);
        if (!m_searchbar_layout) {
                BROWSER_LOGE("elm_layout_add failed");
                return EINA_FALSE;
@@ -1160,14 +1181,14 @@ Eina_Bool Browser_History_Layout::_create_main_layout(void)
        }
 
        m_history_genlist_item_class.decorate_item_style = "mode/slide2";
-       m_history_genlist_item_class.item_style = "2text.2icon.4";
-       m_history_genlist_item_class.decorate_all_item_style = "edit_default";
+       m_history_genlist_item_class.item_style = "dialogue/2text.2icon.3";
+       m_history_genlist_item_class.decorate_all_item_style = "dialogue/edit";
        m_history_genlist_item_class.func.text_get = __genlist_label_get_cb;
        m_history_genlist_item_class.func.content_get = __genlist_icon_get_cb;
        m_history_genlist_item_class.func.state_get = NULL;
        m_history_genlist_item_class.func.del = NULL;
 
-       m_history_group_title_class.item_style = "grouptitle";
+       m_history_group_title_class.item_style = "dialogue/title";
        m_history_group_title_class.func.text_get = __genlist_date_label_get_cb;
        m_history_group_title_class.func.content_get = NULL;
        m_history_group_title_class.func.state_get = NULL;
@@ -1177,6 +1198,7 @@ Eina_Bool Browser_History_Layout::_create_main_layout(void)
 
        evas_object_show(m_content_box);
        elm_object_part_content_set(m_searchbar_layout, "elm.swallow.content", m_content_box);
+       elm_object_part_content_set(m_sub_main_history_layout, "genlist.swallow.contents", m_searchbar_layout);
 
        return EINA_TRUE;
 }
@@ -1354,6 +1376,18 @@ void Browser_History_Layout::__slide_add_to_bookmark_button_clicked_cb(void *dat
        }
 }
 
+void Browser_History_Layout::__slide_share_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       BROWSER_LOGD("[%s]", __func__);
+       if (!data)
+               return;
+
+       Browser_History_DB::history_item *item = (Browser_History_DB::history_item *)data;
+       Browser_History_Layout *history_layout = (Browser_History_Layout *)item->user_data;
+       if (!history_layout->_show_share_popup(item->url.c_str()))
+               BROWSER_LOGE("_show_share_popup failed");
+}
+
 void Browser_History_Layout::_delete_history_item_by_slide_button(Browser_History_DB::history_item *item)
 {
        BROWSER_LOGD("[%s]", __func__);
@@ -1496,10 +1530,14 @@ void Browser_History_Layout::__bookmark_on_off_icon_clicked_cb(void* data, Evas*
 
        int bookmark_id = -1;
        if (m_data_manager->get_history_db()->is_in_bookmark(item->url.c_str(), &bookmark_id)) {
-               evas_object_image_file_set(obj, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL);
+               if (!elm_icon_file_set(obj, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL)) {
+                       BROWSER_LOGE("elm_icon_file_set is failed.\n");
+               }
                m_data_manager->get_bookmark_view()->delete_bookmark_item(bookmark_id);
        } else {
-               evas_object_image_file_set(obj, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL);
+               if (!elm_icon_file_set(obj, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL)) {
+                       BROWSER_LOGE("elm_icon_file_set is failed.\n");
+               }
                m_data_manager->get_bookmark_view()->append_bookmark_item(item->title.c_str(), item->url.c_str());
        }
 }
@@ -1530,15 +1568,19 @@ Evas_Object *Browser_History_Layout::__genlist_icon_get_cb(void *data, Evas_Obje
                        return default_favicon;
                }
        } else if (!strncmp(part, "elm.icon.2", strlen("elm.icon.2"))) {
-               Evas_Object *bookmark_icon = evas_object_image_add(evas_object_evas_get(obj));
-               evas_object_image_load_size_set(bookmark_icon, 64 * elm_scale_get(), 64 * elm_scale_get());
-               evas_object_image_fill_set(bookmark_icon, 0, 0, 64 * elm_scale_get(), 64 * elm_scale_get());
-
-               if (m_data_manager->get_history_db()->is_in_bookmark(item->url.c_str(), NULL))
-                       evas_object_image_file_set(bookmark_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL);
-               else
-                       evas_object_image_file_set(bookmark_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL);
-
+               Evas_Object *bookmark_icon = elm_icon_add(obj);
+               if (m_data_manager->get_history_db()->is_in_bookmark(item->url.c_str(), NULL)) {
+                       if (!elm_icon_file_set(bookmark_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_on.png", NULL)) {
+                               BROWSER_LOGE("elm_icon_file_set is failed.\n");
+                               return NULL;
+                       }
+               } else {
+                       if (!elm_icon_file_set(bookmark_icon, BROWSER_IMAGE_DIR"/I01_icon_bookmark_off.png", NULL)) {
+                               BROWSER_LOGE("elm_icon_file_set is failed.\n");
+                               return NULL;
+                       }
+               }
+               evas_object_size_hint_aspect_set(bookmark_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
                evas_object_propagate_events_set(bookmark_icon, EINA_FALSE);
                evas_object_repeat_events_set(bookmark_icon, EINA_FALSE);