static void _composer_webkit_resized_cb(void *data, Evas_Object *obj, void *event_info);
static void _composer_webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, void *event_info);
static void _composer_webview_contextmenu_customize_cb(void *data, Evas_Object *webview, void *event_info);
+static void _composer_webview_contextmenu_selected_cb(void *data, Evas_Object *webview, void *event_info);
+
+
static void _changed_cb(void *data, Evas_Object *obj, void *event_info) // This callback is for showing(hiding) X marked button.
{
ewk_setting_editable_link_behavior_set(ewkSetting, EWK_EDITABLE_LINK_BEHAVIOR_NEVER_LIVE);
if (ugd->isRotated == true) {
- _composer_resize_body_webview(ugd, 316);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
} else {
- _composer_resize_body_webview(ugd, ugd->ime_height);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
}
if (ugd->selected_entry == ugd->body_ewkview) {
_composer_attachment_contract_items(ugd);
// ugd->bringin_timer = ecore_timer_add(0.7f, _composer_bringin_cb, ugd);
-
+ elm_layout_sizing_eval(ugd->c_layout);
if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_SET_FOCUS, _composer_script_executed_cb, 0) == EINA_FALSE)
debug_log("COMPOSER_JS_SET_FOCUS failed.");
}
EmailComposerUGD *ugd = (EmailComposerUGD *)data;
if (ugd->isRotated == true) {
- _composer_resize_body_webview(ugd, 316);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
} else {
- _composer_resize_body_webview(ugd, ugd->ime_height);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
}
}
{
debug_log("");
int i = 0, count = 0;
+ Eina_Bool sel = EINA_FALSE, has_content = EINA_FALSE;
Ewk_Context_Menu* contextmenu = (Ewk_Context_Menu*)event_info;
Ewk_Context_Menu_Item* menu_item = NULL;
+ Ewk_Context_Menu_Item_Tag menu_item_tag = EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION;
count = ewk_context_menu_item_count(contextmenu);
+ menu_item = ewk_context_menu_nth_item_get(contextmenu, 0);
+ menu_item_tag = ewk_context_menu_item_tag_get(menu_item);
+ debug_log("menu_item_tag : %d", menu_item_tag);
+
+ switch (menu_item_tag) {
+ case EWK_CONTEXT_MENU_ITEM_TAG_CUT: // selection
+ case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
+ sel = EINA_TRUE;
+ break;
+ case EWK_CONTEXT_MENU_ITEM_TAG_PASTE: // no selection
+ case EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL:
+ sel = EINA_FALSE;
+ break;
+ default:
+ debug_log("No context menu");
+ return;
+ }
for (i = 0; i < count; i++) {
- Ewk_Context_Menu_Item_Tag menu_item_tag = EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION;
- menu_item = ewk_context_menu_nth_item_get(contextmenu, i);
- if (EWK_CONTEXT_MENU_ITEM_TYPE_ACTION != ewk_context_menu_item_type_get(menu_item))
- continue;
-
+ menu_item = ewk_context_menu_nth_item_get(contextmenu, 0);
menu_item_tag = ewk_context_menu_item_tag_get(menu_item);
- debug_log("menu_item_tag : %d", menu_item_tag);
+ debug_log("menu_item_tag in for: %d", menu_item_tag);
+ if (menu_item_tag == EWK_CONTEXT_MENU_ITEM_TAG_PASTE) { // has content
+ has_content = EINA_TRUE;
+ }
+ ewk_context_menu_item_remove(contextmenu, menu_item);
+ }
- if (menu_item_tag == EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB) {
- ewk_context_menu_item_remove(contextmenu, menu_item);
+ debug_log("Sel = %d , Content = %d", sel, has_content);
+
+ if (sel == EINA_FALSE) {
+ if (has_content == EINA_FALSE) {
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD, _("IDS_EMAIL_OPT_SELECT"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, _("IDS_EMAIL_OPT_SELECT_ALL"), EINA_TRUE);
+ //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+ } else {
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD, _("IDS_EMAIL_OPT_SELECT"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, _("IDS_EMAIL_OPT_SELECT_ALL"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_PASTE, _("IDS_EMAIL_OPT_PASTE"), EINA_TRUE);
+ //ewk_context_menu_item_append_as_action(contextmenu, menu_item, menu_name, EINA_TRUE); // for Clipboard
+ //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+ }
+ } else {
+ if (has_content == EINA_FALSE) {
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_COPY, _("IDS_EMAIL_OPT_COPY"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_CUT, _("IDS_EMAIL_OPT_CUT"), EINA_TRUE);
+ //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+ } else {
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_COPY, _("IDS_EMAIL_OPT_COPY"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_CUT, _("IDS_EMAIL_OPT_CUT"), EINA_TRUE);
+ ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_PASTE, _("IDS_EMAIL_OPT_PASTE"), EINA_TRUE);
+ //ewk_context_menu_item_append_as_action(contextmenu, menu_item, menu_name, EINA_TRUE); // for Clipboard
+ //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
}
- //if (ewk_context_menu_item_append_as_action(contextmenu, 10001/*CUSTOM_CONTEXT_MENU_ITEM_TEST_TAG*/, "test", EINA_TRUE) == EINA_FALSE)
- // debug_log("failed");
}
}
+static void _composer_webview_contextmenu_selected_cb(void *data, Evas_Object *webview, void *event_info)
+{
+ debug_log("");
+
+ EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+ Ewk_Context_Menu_Item* menu_item = (Ewk_Context_Menu_Item*)event_info;
+ Ewk_Context_Menu_Item_Tag menu_item_tag = EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION;
+
+ debug_log("menu_item : %d", menu_item);
+ menu_item_tag = ewk_context_menu_item_tag_get(menu_item);
+ debug_log("menu_item_tag : %d", menu_item_tag);
+
+ switch (menu_item_tag) {
+ case EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG : //Smart search
+ {
+ service_h service = NULL;
+ const char *keyword = NULL;
+ keyword = ewk_view_text_selection_text_get(ugd->body_ewkview);
+ debug_log("keyword : %s", keyword);
+
+ service_create(&service);
+ service_set_operation(service, SERVICE_OPERATION_SEARCH);
+ service_add_extra_data(service, "http://tizen.org/appcontrol/data/keyword", keyword);
+ service_send_launch_request(service, NULL, NULL);
+ service_destroy(service);
+ }
+ break;
+ default:
+ debug_log("Never here!");
+ }
+}
}
ugd->isRotated = false;
win_main_angle = 0;
- _composer_resize_body_webview(ugd, ugd->ime_height);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
break;
case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
elm_layout_theme_set(ugd->main_layout, "layout", "application", "default");
ugd->option_header_opened = FALSE;
}
ugd->isRotated = false;
- win_main_angle = 180;
- _composer_resize_body_webview(ugd, ugd->ime_height);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
break;
case UG_EVENT_ROTATE_LANDSCAPE:
elm_layout_theme_set(ugd->main_layout, "layout", "application", "noindicator");
}
ugd->isRotated = true;
win_main_angle = 270;
- _composer_resize_body_webview(ugd, 316);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
break;
case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
elm_layout_theme_set(ugd->main_layout, "layout", "application", "noindicator");
ugd->option_header_opened = FALSE;
}
ugd->isRotated = true;
- win_main_angle = 90;
- _composer_resize_body_webview(ugd, 316);
+ _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
break;
case UG_EVENT_REGION_CHANGE:
break;
elm_win_rotation_with_resize_set(ugd->popup_win, win_main_angle);
}
- elm_win_rotation_with_resize_set(ugd->win_main, win_main_angle);
-
// ugd->bringin_timer = ecore_timer_add(0.1f, _composer_bringin_cb, ugd);
}
ugd->account_info = (EmailComposerAccount *) calloc(1, sizeof(EmailComposerAccount));
memset(ugd->account_info, 0x00, sizeof(EmailComposerMail));
- ugd->ime_height = 444;
ugd->priority_option = EMAIL_MAIL_PRIORITY_NORMAL;
}