summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunghwan <junghwan.kang@samsung.com>2012-08-24 19:53:21 +0900
committerJunghwan <junghwan.kang@samsung.com>2012-08-24 19:59:26 +0900
commit60a82f640268dcfa442d0a971123d917f2dc8913 (patch)
tree731b78e7e82cb39dcadefc1527c5ec3a2f35c8e4 /src
parent2190375684e767245067effc53ed12fda55bad36 (diff)
downloadorg.tizen.browser-60a82f640268dcfa442d0a971123d917f2dc8913.tar.gz
org.tizen.browser-60a82f640268dcfa442d0a971123d917f2dc8913.tar.bz2
org.tizen.browser-60a82f640268dcfa442d0a971123d917f2dc8913.zip
Add share message/email function
[Title] Add share message/email function [Issue#] N/A [Problem] N/A [Cause] Policy for TIZEN has been changed [Solution] Add share message/email function [Team] Browser UI [Developer] Junghwan kang [Request] N/A Change-Id: I32604c8c0b6a8977518cefb4e5d58f9c18318337
Diffstat (limited to 'src')
-rwxr-xr-xsrc/browser-bookmark/browser-bookmark-view.cpp38
-rwxr-xr-xsrc/browser-bookmark/browser-bookmark-view.h1
-rwxr-xr-xsrc/browser-common-view.cpp49
-rwxr-xr-xsrc/browser-common-view.h1
-rwxr-xr-xsrc/browser-history/browser-history-layout.cpp29
-rwxr-xr-xsrc/browser-history/browser-history-layout.h1
-rwxr-xr-xsrc/browser-view/browser-context-menu.cpp7
-rwxr-xr-xsrc/browser-view/browser-context-menu.h3
-rwxr-xr-xsrc/browser-view/browser-view.cpp30
-rwxr-xr-xsrc/browser-view/browser-view.h3
10 files changed, 157 insertions, 5 deletions
diff --git a/src/browser-bookmark/browser-bookmark-view.cpp b/src/browser-bookmark/browser-bookmark-view.cpp
index 9bf6579..ffef9e0 100755
--- a/src/browser-bookmark/browser-bookmark-view.cpp
+++ b/src/browser-bookmark/browser-bookmark-view.cpp
@@ -1359,6 +1359,30 @@ Evas_Object *Browser_Bookmark_View::__genlist_icon_get_cb(void *data, Evas_Objec
evas_object_smart_callback_add(edit_button, "clicked", __slide_edit_button_clicked_cb, item);
return edit_button;
} else if (!strncmp(part, "elm.slide.swallow.2", strlen("elm.slide.swallow.2"))) {
+ if (item->is_folder) {
+ Evas_Object *delete_button = elm_button_add(obj);
+ if (!delete_button) {
+ BROWSER_LOGE("elm_button_add is failed.\n");
+ return NULL;
+ }
+ elm_object_style_set(delete_button, "text_only/sweep");
+ elm_object_text_set(delete_button, BR_STRING_DELETE);
+ if (!item->is_editable)
+ elm_object_disabled_set(delete_button, EINA_TRUE);
+ evas_object_smart_callback_add(delete_button, "clicked", __slide_delete_button_clicked_cb, item);
+ return delete_button;
+ } else {
+ Evas_Object *share_button = elm_button_add(obj);
+ if (!share_button) {
+ BROWSER_LOGE("elm_button_add is failed.\n");
+ return NULL;
+ }
+ elm_object_style_set(share_button, "text_only/sweep");
+ elm_object_text_set(share_button, BR_STRING_SHARE);
+ evas_object_smart_callback_add(share_button, "clicked", __slide_share_button_clicked_cb, item);
+ return share_button;
+ }
+ } else if (!strncmp(part, "elm.slide.swallow.3", strlen("elm.slide.swallow.3"))) {
Evas_Object *delete_button = elm_button_add(obj);
if (!delete_button) {
BROWSER_LOGE("elm_button_add is failed.\n");
@@ -1631,6 +1655,18 @@ void Browser_Bookmark_View::_delete_bookmark_item_by_slide_button(Browser_Bookma
show_notify_popup(BR_STRING_DELETED, 3, EINA_TRUE);
}
+void Browser_Bookmark_View::__slide_share_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ BROWSER_LOGD("[%s]", __func__);
+ if (!data)
+ return;
+
+ Browser_Bookmark_DB::bookmark_item *item = (Browser_Bookmark_DB::bookmark_item *)data;
+ Browser_Bookmark_View *bookmark_view = (Browser_Bookmark_View *)(item->user_data_1);
+ if (!bookmark_view->_show_share_popup(item->url.c_str()))
+ BROWSER_LOGE("_show_share_popup failed");
+}
+
void Browser_Bookmark_View::__slide_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
BROWSER_LOGD("[%s]", __func__);
@@ -2079,7 +2115,7 @@ Evas_Object *Browser_Bookmark_View::_create_main_folder_genlist(void)
evas_object_smart_callback_add(genlist, "moved", __genlist_move_cb, this);
m_bookmark_genlist_item_class.item_style = "1text.1icon.2";
- m_bookmark_genlist_item_class.decorate_item_style = "mode/slide2";
+ m_bookmark_genlist_item_class.decorate_item_style = "mode/slide3.text";
m_bookmark_genlist_item_class.decorate_all_item_style = "edit_default";
m_bookmark_genlist_item_class.func.text_get = __genlist_label_get_cb;
m_bookmark_genlist_item_class.func.content_get = __genlist_icon_get_cb;
diff --git a/src/browser-bookmark/browser-bookmark-view.h b/src/browser-bookmark/browser-bookmark-view.h
index 674b65a..4036325 100755
--- a/src/browser-bookmark/browser-bookmark-view.h
+++ b/src/browser-bookmark/browser-bookmark-view.h
@@ -87,6 +87,7 @@ private:
static void __delete_processing_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
static void __slide_edit_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void __slide_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+ static void __slide_share_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void __edit_bookmark_item_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void __rename_folder_unfocus_cb(void *data, Evas_Object *obj, void *event_info);
static void __rename_folder_entry_enter_key_cb(void *data, Evas_Object *obj, void *event_info);
diff --git a/src/browser-common-view.cpp b/src/browser-common-view.cpp
index 6b9bcbe..2853edf 100755
--- a/src/browser-common-view.cpp
+++ b/src/browser-common-view.cpp
@@ -783,6 +783,55 @@ Eina_Bool Browser_Common_View::_share_via_nfc(std::string url)
return EINA_TRUE;
}
+Eina_Bool Browser_Common_View::_show_share_popup(const char *url)
+{
+ BROWSER_LOGE("url=[%s]", url);
+ if (!url || strlen(url) == 0) {
+ BROWSER_LOGE("url is empty");
+ return EINA_FALSE;
+ }
+
+ m_share_url = std::string(url);
+
+ m_sns_path_list.clear();
+ m_sns_name_list.clear();
+ m_sns_icon_list.clear();
+
+ m_share_popup = elm_popup_add(m_navi_bar);
+ if (!m_share_popup) {
+ BROWSER_LOGE("elm_popup_add failed");
+ return EINA_FALSE;
+ }
+ elm_object_style_set(m_share_popup, "menustyle");
+ elm_object_part_text_set(m_share_popup, "title,text", BR_STRING_SHARE);
+ evas_object_size_hint_weight_set(m_share_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ m_share_list = elm_list_add(m_share_popup);
+ if (!m_share_list) {
+ BROWSER_LOGE("elm_list_add failed");
+ return EINA_FALSE;
+ }
+ evas_object_size_hint_weight_set(m_share_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_share_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ elm_list_item_append(m_share_list, BR_STRING_MESSAGES, NULL, NULL, __send_via_message_cb, this);
+ elm_list_item_append(m_share_list, BR_STRING_EMAIL, NULL, NULL, __send_via_email_cb, this);
+
+ evas_object_show(m_share_list);
+
+ Evas_Object *cancel_button = elm_button_add(m_share_popup);
+ elm_object_text_set(cancel_button, BR_STRING_CANCEL);
+ elm_object_part_content_set(m_share_popup, "button1", cancel_button);
+ elm_object_style_set(cancel_button, "popup_button/default");
+ evas_object_smart_callback_add(cancel_button, "clicked", __popup_response_cb, this);
+
+ elm_object_content_set(m_share_popup, m_share_list);
+
+ evas_object_show(m_share_popup);
+
+ return EINA_TRUE;
+}
+
void Browser_Common_View::__popup_response_cb(void* data, Evas_Object* obj, void* event_info)
{
BROWSER_LOGD("%s, event_info=%d", __func__, (int)event_info);
diff --git a/src/browser-common-view.h b/src/browser-common-view.h
index 0234ebf..56b7842 100755
--- a/src/browser-common-view.h
+++ b/src/browser-common-view.h
@@ -53,6 +53,7 @@ protected:
Evas_Object *_capture_snapshot(Browser_Window *window, float scale);
void _set_navigationbar_title(const char *title);
Eina_Bool _has_url_sheme(const char *url);
+ Eina_Bool _show_share_popup(const char *url);
Eina_Bool _launch_streaming_player(const char *url, const char *cookie = NULL);
Eina_Bool _send_via_message(std::string url, std::string to, Eina_Bool attach_file = EINA_FALSE);
Eina_Bool _send_via_email(std::string url, Eina_Bool attach_file = EINA_FALSE);
diff --git a/src/browser-history/browser-history-layout.cpp b/src/browser-history/browser-history-layout.cpp
index 540e46a..9eb3d33 100755
--- a/src/browser-history/browser-history-layout.cpp
+++ b/src/browser-history/browser-history-layout.cpp
@@ -1159,7 +1159,7 @@ Eina_Bool Browser_History_Layout::_create_main_layout(void)
return EINA_FALSE;
}
- m_history_genlist_item_class.decorate_item_style = "mode/slide2";
+ m_history_genlist_item_class.decorate_item_style = "mode/slide3";
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.func.text_get = __genlist_label_get_cb;
@@ -1354,6 +1354,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__);
@@ -1564,11 +1576,22 @@ Evas_Object *Browser_History_Layout::__genlist_icon_get_cb(void *data, Evas_Obje
LOGD("elm_button_add() is failed.");
return NULL;
}
+
+ elm_object_style_set(button, "sweep/multiline");
+ elm_object_text_set(button, BR_STRING_SHARE);
+ evas_object_smart_callback_add(button, "clicked", __slide_share_button_clicked_cb, item);
+ return button;
+ } else if (!strncmp(part, "elm.slide.swallow.2", strlen("elm.slide.swallow.2"))) {
+ Evas_Object *button = elm_button_add(obj);
+ if (!button) {
+ LOGD("elm_button_add() is failed.");
+ return NULL;
+ }
elm_object_style_set(button, "sweep/multiline");
elm_object_text_set(button, BR_STRING_ADD_TO_BOOKMARKS);
evas_object_smart_callback_add(button, "clicked", __slide_add_to_bookmark_button_clicked_cb, item);
- return button;
- } else if (!strncmp(part, "elm.slide.swallow.2", strlen("elm.slide.swallow.2"))) {
+ return button;
+ } else if (!strncmp(part, "elm.slide.swallow.3", strlen("elm.slide.swallow.3"))) {
Evas_Object *button = elm_button_add(obj);
if (!button) {
LOGD("elm_button_add() is failed.");
diff --git a/src/browser-history/browser-history-layout.h b/src/browser-history/browser-history-layout.h
index 245717f..0cd901b 100755
--- a/src/browser-history/browser-history-layout.h
+++ b/src/browser-history/browser-history-layout.h
@@ -77,6 +77,7 @@ private:
static void __edit_mode_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
static void __edit_mode_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
static void __slide_add_to_bookmark_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+ static void __slide_share_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void __slide_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void __delete_confirm_response_by_edit_mode_cb(void *data, Evas_Object *obj, void *event_info);
static void __delete_confirm_response_by_slide_button_cb(void *data, Evas_Object *obj, void *event_info);
diff --git a/src/browser-view/browser-context-menu.cpp b/src/browser-view/browser-context-menu.cpp
index 8b6a861..be719d3 100755
--- a/src/browser-view/browser-context-menu.cpp
+++ b/src/browser-view/browser-context-menu.cpp
@@ -96,6 +96,7 @@ void Browser_Context_Menu::__get_context_menu_from_proposed_context_menu_cb(void
break;
case EWK_CONTEXT_MENU_ITEM_TAG_COPY:
ewk_context_menu_item_append_as_action(menu, tag, BR_STRING_CTXMENU_COPY, true);
+ ewk_context_menu_item_append_as_action(menu, CustomContextMenuItemSelectedTextShareTag, BR_STRING_CTXMENU_SHARE, true);
break;
case EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL:
ewk_context_menu_item_append_as_action(menu, tag, BR_STRING_SELECT_ALL, true);
@@ -122,9 +123,15 @@ void Browser_Context_Menu::__custom_context_menu_item_selected_cb(void *data, Ev
BROWSER_LOGD("link url=[%s]", link_url_string.c_str());
std::string image_url_string = ewk_context_menu_item_image_url_get(item);
BROWSER_LOGD("image url=[%s]", image_url_string.c_str());
+ const char *selected_text = ewk_view_text_selection_text_get(context_menu->m_ewk_view);
Ewk_Context_Menu_Item_Tag tag = ewk_context_menu_item_tag_get(item);
switch (tag) {
+ case CustomContextMenuItemSelectedTextShareTag:
+ BROWSER_LOGD("Share selected text[%s]", selected_text);
+ if (selected_text && strlen(selected_text) > 0)
+ context_menu->_show_share_popup(selected_text);
+ break;
default:
break;
diff --git a/src/browser-view/browser-context-menu.h b/src/browser-view/browser-context-menu.h
index 4c1735a..8118a49 100755
--- a/src/browser-view/browser-context-menu.h
+++ b/src/browser-view/browser-context-menu.h
@@ -37,7 +37,8 @@ public:
enum {
CustomContextMenuItemBaseApplicationTag = EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG,
CustomContextMenuItemImageSendViaMessageTag,
- CustomContextMenuItemImageSendViaEmailTag
+ CustomContextMenuItemImageSendViaEmailTag,
+ CustomContextMenuItemSelectedTextShareTag
};
private:
static void __get_context_menu_from_proposed_context_menu_cb(void *data, Evas_Object *obj, void *event_info);
diff --git a/src/browser-view/browser-view.cpp b/src/browser-view/browser-view.cpp
index 4dab52d..cbfa592 100755
--- a/src/browser-view/browser-view.cpp
+++ b/src/browser-view/browser-view.cpp
@@ -1961,6 +1961,19 @@ void Browser_View::__web_app_icon_url_get_cb(const char* icon_url, void* user_da
}
#endif
+void Browser_View::__url_editfield_share_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ BROWSER_LOGD("[%s]", __func__);
+ if (!data)
+ return;
+
+ Browser_View *browser_view = (Browser_View *)data;
+ const char *selected_text = elm_entry_selection_get(br_elm_editfield_entry_get(browser_view->m_option_header_url_edit_field));
+
+ if (browser_view->_show_share_popup(selected_text))
+ BROWSER_LOGE("_show_share_popup failed");
+}
+
Eina_Bool Browser_View::__show_scissorbox_view_idler_cb(void *data)
{
if (!data)
@@ -2032,6 +2045,18 @@ void Browser_View::_destroy_scissorbox_view(void)
evas_object_show(m_control_bar);
}
+void Browser_View::__share_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ BROWSER_LOGD("[%s]", __func__);
+ if (!data)
+ return;
+
+ Browser_View *browser_view = (Browser_View *)data;
+ browser_view->_destroy_more_context_popup();
+ browser_view->_show_share_popup(browser_view->get_url().c_str());
+}
+
+
void Browser_View::__private_cb(void *data, Evas_Object *obj, void *event_info)
{
BROWSER_LOGD("[%s]", __func__);
@@ -2535,6 +2560,9 @@ Eina_Bool Browser_View::_show_more_context_popup(void)
|| _get_edit_mode() == BR_FIND_WORD_MODE)
elm_object_item_disabled_set(sub_menu, EINA_TRUE);
+ sub_menu = elm_ctxpopup_item_append(m_more_context_popup, BR_STRING_SHARE, NULL,
+ __share_cb, this);
+
m_bookmark_on_off_icon = elm_icon_add(m_more_context_popup);
if(m_data_manager->get_history_db()->is_in_bookmark(get_url().c_str(), NULL)) {
@@ -2748,6 +2776,8 @@ Evas_Object *Browser_View::_create_option_header_url_layout(void)
BROWSER_LOGE("elm_editfield_add failed");
return NULL;
}
+ elm_entry_context_menu_item_add(br_elm_editfield_entry_get(m_option_header_url_edit_field),
+ BR_STRING_CTXMENU_SHARE, NULL, ELM_ICON_NONE, __url_editfield_share_clicked_cb, this);
elm_object_part_content_set(m_option_header_url_entry_layout, "elm.swallow.entry", m_option_header_url_edit_field);
// br_elm_editfield_entry_single_line_set(m_option_header_url_edit_field, EINA_TRUE);
diff --git a/src/browser-view/browser-view.h b/src/browser-view/browser-view.h
index 9627f41..2dfe594 100755
--- a/src/browser-view/browser-view.h
+++ b/src/browser-view/browser-view.h
@@ -118,6 +118,8 @@ private:
static void __title_changed_cb(void *data, Evas_Object *obj, void *event_info);
static void __load_nonempty_layout_finished_cb(void *data, Evas_Object *obj, void *event_info);
+ static void __url_editfield_share_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+
/* imf event callback functions */
static void __url_entry_imf_event_cb(void *data, Ecore_IMF_Context *ctx, int value);
static void __find_word_entry_imf_event_cb(void *data, Ecore_IMF_Context *ctx, int value);
@@ -198,6 +200,7 @@ private:
Eina_Bool _create_zoom_buttons(void);
#endif
static void __expand_option_header_cb(void *data, Evas_Object *obj, void *event_info);
+ static void __share_cb(void *data, Evas_Object *obj, void *event_info);
static void __private_cb(void *data, Evas_Object *obj, void *event_info);
static void __private_check_change_cb(void *data, Evas_Object *obj, void *event_info);
static void __bookmark_cb(void *data, Evas_Object *obj, void *event_info);