Implement the Share menu 25/85225/4
authorHyeKyoung Hwang <cookie@samsung.com>
Wed, 24 Aug 2016 08:08:14 +0000 (17:08 +0900)
committerjaekuk lee <juku1999@samsung.com>
Mon, 29 Aug 2016 01:11:25 +0000 (18:11 -0700)
[ Issue ] http://suprem.sec.samsung.net/jira/browse/TWF-1978
[ Problem ] The share menu is not working
[ Solution ] Implement the share menu

Change-Id: Ie3df8d04fa2fd1d6e542548f631e9a7ff885f627
Signed-off-by: HyeKyoung Hwang <cookie@samsung.com>
services/WebPageUI/WebPageUI.cpp
services/WebPageUI/WebPageUI.h [changed mode: 0644->0755]

index 5ed6583f14d77a2f8d0cc0c3087feb270271ba64..2ef887dba94cff9dfed56956b1f8c59279b636fd 100755 (executable)
@@ -26,6 +26,7 @@
 #include "WebPageUIStatesManager.h"
 #include <shortcut_manager.h>
 #include <string>
+#include <app_control.h>
 
 namespace tizen_browser {
 namespace base_ui {
@@ -410,6 +411,9 @@ void WebPageUI::_cm_share_clicked(void* data, Evas_Object*, void* )
     if (data != nullptr) {
         WebPageUI* webPageUI = static_cast<WebPageUI*>(data);
         _cm_dismissed(nullptr, webPageUI->m_ctxpopup, nullptr);
+
+    std::string uri = webPageUI->getURI();
+    webPageUI->launch_share(uri.c_str());
     } else
         BROWSER_LOGW("[%s] data = nullptr", __PRETTY_FUNCTION__);
 }
@@ -823,5 +827,37 @@ Eina_Bool WebPageUI::_hideDelay(void *data)
     return ECORE_CALLBACK_CANCEL;
 }
 
+void WebPageUI:: launch_share(const char *uri)
+{
+    BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+
+    app_control_h app_control = NULL;
+    if (app_control_create(&app_control) < 0) {
+        BROWSER_LOGD("Fail to create app_control handle");
+        return ;
+    }
+
+    if (app_control_set_operation(app_control, APP_CONTROL_OPERATION_SHARE_TEXT) < 0) {
+        BROWSER_LOGD("Fail to set app_control operation");
+        app_control_destroy(app_control);
+        return ;
+    }
+
+    if (app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, uri) < 0) {
+        BROWSER_LOGD("Fail to set extra data : APP_CONTROL_DATA_TEXT");
+        app_control_destroy(app_control);
+        return ;
+    }
+
+    if (app_control_send_launch_request(app_control, NULL, NULL) < 0) {
+        BROWSER_LOGD("Fail to launch app_control operation");
+        app_control_destroy(app_control);
+        return ;
+    }
+
+    app_control_destroy(app_control);
+    return ;
+}
+
 }   // namespace tizen_browser
 }   // namespace base_ui
old mode 100644 (file)
new mode 100755 (executable)
index 9af467e..1a1cf44
@@ -162,6 +162,7 @@ private:
     static void _cm_settings_clicked(void*, Evas_Object*, void*);
     static void _cm_add_to_hs_clicked(void*, Evas_Object*, void*);
     static int result_cb(int ret, void *data);
+    static void launch_share(const char *uri);
 
     void createLayout();
     void createErrorLayout();