Applied the media server
authorjc47.park <jc47.park@samsung.com>
Fri, 30 Nov 2012 06:10:20 +0000 (15:10 +0900)
committerjc47.park <jc47.park@samsung.com>
Fri, 30 Nov 2012 06:10:20 +0000 (15:10 +0900)
common/CMakeLists.txt
common/src/email-utils.c
packaging/org.tizen.email.spec
viewer/CMakeLists.txt
viewer/src/email-viewer-webview.c

index ca52802..03ef47b 100755 (executable)
@@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES(${CMAKE_COMMON_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-common REQUIRED ecore ecore-imf appcore-common glib-2.0 gobject-2.0 email-service
-       dlog db-util elementary efreet-mime drm-client ecore-x sysman vconf evas eina edje icu-i18n ui-gadget-1)
+       capi-content-media-content dlog db-util elementary efreet-mime drm-client ecore-x sysman vconf evas eina edje icu-i18n ui-gadget-1)
 
 FOREACH(flag ${pkgs-common_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index a130cd9..747d5af 100755 (executable)
@@ -732,7 +732,7 @@ int email_attachments_save_file(const gchar *path, gchar *newpath, gboolean(*cop
 {
        debug_log("");
        RETURN_VAL_IF_FAIL(STR_VALID(path), EMAIL_EXT_SAVE_ERR_UNKNOWN);
-
+       int ret = 0;
        gchar new_path[MAX_PATH_LEN] = { 0, };
        gchar tmp_path[MAX_PATH_LEN] = { 0, };
        gchar new_filename[MAX_PATH_LEN] = { 0, };
@@ -799,25 +799,35 @@ int email_attachments_save_file(const gchar *path, gchar *newpath, gboolean(*cop
        debug_log("new_path:%s", new_path);
 
        /* Move for DRM file */
+       
+       ret = media_content_connect();
+       if (!ret) {
+               _create_download_folder();
+
+               /* Copy for non-DRM */
+               if (access(new_path, F_OK) != -1) {
+                       debug_log("file existed");
+                       err = EMAIL_EXT_SAVE_ERR_ALREADY_EXIST;
+               } else {
+                       saved = _copy_actual_file(path, new_path, copy_file_cb);
+                       debug_log("saved(%d), err(%d), errno(%d)", saved, err, errno);
+
+                       if (saved)
+                               err = EMAIL_EXT_SAVE_ERR_NONE;
+                       else
+                               err = EMAIL_EXT_SAVE_ERR_UNKNOWN;
+                       ret = media_content_scan_file(new_path);
+                       debug_log("media_content_scan_file: %d", ret);
+               }
 
-       _create_download_folder();
-
-       /* Copy for non-DRM */
-       if (access(new_path, F_OK) != -1) {
-               debug_log("file existed");
-               err = EMAIL_EXT_SAVE_ERR_ALREADY_EXIST;
+               snprintf(newpath, MAX_PATH_LEN, "%s", new_path);
+               ret = media_content_disconnect();
+               if (ret) {
+                       debug_log("media_content_disconnect() is failed!");
+               }               
        } else {
-               saved = _copy_actual_file(path, new_path, copy_file_cb);
-               debug_log("saved(%d), err(%d), errno(%d)", saved, err, errno);
-
-               if (saved)
-                       err = EMAIL_EXT_SAVE_ERR_NONE;
-               else
-                       err = EMAIL_EXT_SAVE_ERR_UNKNOWN;
+               debug_log("media_content_connect() is failed!");
        }
-
-       snprintf(newpath, MAX_PATH_LEN, "%s", new_path);
-
        return err;
 }
 
index 2a12568..563a170 100755 (executable)
@@ -37,6 +37,7 @@ BuildRequires:  pkgconfig(drm-client)
 BuildRequires:  pkgconfig(status)
 BuildRequires:  pkgconfig(capi-media-metadata-extractor)
 BuildRequires:  pkgconfig(capi-media-image-util)
+BuildRequires:  pkgconfig(capi-content-media-content)
 BuildRequires:  pkgconfig(libexif)
 BuildRequires:  pkgconfig(libxml-2.0)
 Requires: email-service
index 5de6a6e..17aa4ab 100755 (executable)
@@ -20,7 +20,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-viewer REQUIRED appcore-efl ui-gadget-1 x11 elementary ecore glib-2.0 gobject-2.0
-               status capi-media-metadata-extractor capi-media-image-util
+               status capi-media-metadata-extractor capi-media-image-util capi-content-media-content
                email-service edbus capi-appfw-application vconf ewebkit2 contacts-service sysman bundle dlog efreet-mime libmedia-utils calendar-service2 ethumb)
 
 FOREACH(flag ${pkgs-viewer_CFLAGS})
index 2ccf985..275fef3 100755 (executable)
@@ -560,18 +560,32 @@ static void _webview_contextmenu_selected_cb(void *data, Evas_Object *webview, v
 
        case EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG + 1 : //Save image
        {
-               if (viewer_get_filepath_from_path(DIR_DEFAULT_MEDIA_PHONE"/Images", img_url, new_path, EINA_TRUE) != EMAIL_EXT_SAVE_ERR_NONE) {
+               int ret = 0;
+               if (viewer_get_filepath_from_path(DIR_DEFAULT_MEDIA_PHONE"/Downloads", img_url, new_path, EINA_TRUE) != EMAIL_EXT_SAVE_ERR_NONE) {
                        debug_log("file exist!");
                }
 
-               if (viewer_save_file(new_path, img_buf, img_buf_len) == EINA_FALSE) {
-                       debug_log("viewer_save_file error!");
+               ret = media_content_connect();
+               if (!ret) {
+                       if (viewer_save_file(new_path, img_buf, img_buf_len) == EINA_FALSE) {
+                               debug_log("viewer_save_file error!");
+                       } else {
+                               char str[128] = { 0, };
+                               snprintf(str, sizeof(str), "%s", dgettext("sys_string", "IDS_COM_POP_SAVED"));
+                               /*_show_select_info(ug_data, str);*/
+                               ret = status_message_post(str);
+                               if (ret)
+                                       debug_log("status_message_post failed: %d", ret);
+                               ret = media_content_scan_file(new_path);
+                               debug_log("media_content_scan_file: %d", ret);
+                       }
+                       
+                       ret = media_content_disconnect();
+                       if (ret) {
+                               debug_log("media_content_disconnect() is failed!");
+                       }
                } else {
-                       char str[128] = { 0, };
-                       snprintf(str, sizeof(str), "%s", dgettext("sys_string", "IDS_COM_POP_SAVED"));
-                       int ret = status_message_post(str);
-                       if (ret)
-                               debug_log("status_message_post failed: %d", ret);
+                       debug_log("media_content_connect() is failed!");
                }
        }
        break;