Remove tag if when paste x-elementary-markup type of text
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / ClipboardHelper.cpp
index 32ffdd6..e23264a 100755 (executable)
@@ -108,11 +108,11 @@ static Eina_Bool clientMessageCallback(void* data, int type, void* event);
 ClipboardHelper::ClipboardHelper(EwkViewImpl* viewImpl)
     : m_viewImpl(viewImpl)
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
-    , m_clipboardWindowOpened(false)
-    , m_cbhmPropertyChangeHandler(0)
     , m_selectionClearHandler(0)
     , m_selectionNotifyHandler(0)
     , m_clientMessageHandler(0)
+    , m_cbhmPropertyChangeHandler(0)
+    , m_clipboardWindowOpened(false)
 #endif
 {
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
@@ -211,8 +211,6 @@ void ClipboardHelper::setData(const String& data, const String& type)
 {
     Ecore_X_Atom dataType = 0;
 
-    showSavedNotiPopup();
-
     if (type == "PlainText" || type == "URIList" || type == "URL")
         dataType = ecore_x_atom_get("UTF8_STRING");
     else if (type == "Markup")
@@ -605,7 +603,8 @@ bool ClipboardHelper::setClipboardItem(Ecore_X_Atom dataType,const String& data)
 
 void ClipboardHelper::openClipboardWindow(bool isContentRichlyEditable)
 {
-    clearClipboardSelectionHandler();
+    if (!isClipboardWindowOpened())
+        clearClipboardSelectionHandler();
 
     initializeAtomList();
     if (isContentRichlyEditable)
@@ -752,6 +751,9 @@ bool ClipboardHelper::retrieveClipboardItem(int index, int* format, String* pDat
     else
         return false;
 
+    if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
+        *pData = String::fromUTF8(evas_textblock_text_markup_to_utf8(NULL, pData->utf8().data()));
+
     return true;
 }
 
@@ -807,39 +809,6 @@ void ClipboardHelper::updateClipboardWindowState(Ecore_X_Event_Window_Property*
     else if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
         m_clipboardWindowOpened = true;
 }
-
-void ClipboardHelper::showSavedNotiPopup()
-{
-    bindtextdomain("WebKit", WEBKIT_TEXT_DIR);
-
-    Evas_Object* parent = elm_object_parent_widget_get(m_viewImpl->view());
-    Evas_Object* notify = elm_notify_add(parent);
-    if (!notify) {
-        TIZEN_LOGE("elm_notify_add failed");
-        return;
-    }
-    elm_notify_align_set(notify, 0.5, 1.0);
-    evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_size_hint_align_set(notify, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-    Evas_Object* notifyLayout = elm_layout_add(notify);
-    if (!notifyLayout) {
-        TIZEN_LOGE("elm_layout_add failed");
-        return;
-    }
-
-    if (elm_win_rotation_get(parent) % 180)
-        elm_layout_theme_set(notifyLayout, "standard", "selectioninfo", "horizontal/bottom_64");
-    else
-        elm_layout_theme_set(notifyLayout, "standard", "selectioninfo", "vertical/bottom_64");
-    evas_object_size_hint_weight_set(notifyLayout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_size_hint_align_set(notifyLayout, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    elm_object_content_set(notify, notifyLayout);
-    edje_object_part_text_set(elm_layout_edje_get(notifyLayout), "elm.text", dgettext("WebKit","IDS_COM_POP_COPIED_TO_CLIPBOARD"));
-    elm_notify_timeout_set(notify, 2);
-
-    evas_object_show(notify);
-}
 #endif // TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD
 }// namespace WebKit