Added Share Feature in timeline and album details views. 43/258843/5
authorshivamv <shivam.v2@samsung.com>
Wed, 26 May 2021 11:47:06 +0000 (17:17 +0530)
committerShivam Varshney <shivam.v2@samsung.com>
Mon, 31 May 2021 06:39:31 +0000 (06:39 +0000)
Change-Id: Ifa67a9cfa70956776591e436cf20a5dbf5a91aea
Signed-off-by: shivamv <shivam.v2@samsung.com>
inc/util/gl-util.h [changed mode: 0644->0755]
src/2dview/gl-thumbs-edit.c
src/2dview/gl-thumbs.c
src/2dview/gl-timeline.c
src/data/gl-local-data.c [changed mode: 0644->0755]
src/util/gl-util.c

old mode 100644 (file)
new mode 100755 (executable)
index 50365ae..9564655
@@ -224,6 +224,7 @@ extern "C" {
        gl_cluster *_gl_albums_get_current(void *data);
        void _gl_set_reorder_value(void *data);
        void _gl_set_reorder_state_preference();
+       char* _gl_get_media_url(Eina_List* medialist, int index);
 
 #ifdef __cplusplus
 }
index fbbbdbbb0674b620f313fe9fed151fcfc244ad6e..e11bbcaf00de7a7285d4f54b7553fa998b66c7dd 100755 (executable)
 #include "gl-controlbar.h"
 #include "gl-notify.h"
 #include "gl-popup.h"
+#include "gl-util.h"
+#include "gl-data-util.h"
+#include "gl-data.h"
+
+static app_control_h g_pServiceShare = NULL;
+static char** g_pShareList = NULL;
+static int g_nShareListSize = 0;
+static bool g_bSharePanelLaunched = FALSE;
+
+static void gl_create_launch_thumbs_share_panel(void* data)
+{
+       if (!data)
+               return;
+       gl_appdata* ad = (gl_appdata*)data;
+
+       char* pOperation = "http://tizen.org/appcontrol/operation/share";
+       int nCounter;
+       int nErr = 0;
+
+       if (g_nShareListSize > 1) {
+               pOperation = "http://tizen.org/appcontrol/operation/multi_share";
+       }
+
+       if (!g_pShareList) {
+               gl_dbgW("[WARNING] Fail to get uri at first.");
+               goto ERROR_EXCEPTION;
+       }
+
+       if (!g_pServiceShare) {
+               nErr = app_control_create(&g_pServiceShare);
+               if (nErr != APP_CONTROL_ERROR_NONE) {
+                       gl_dbgE("Fail to create ug service handle - [0x%x]",
+                               nErr);
+                       goto ERROR_EXCEPTION;
+               }
+       }
+
+       nErr = app_control_set_uri(g_pServiceShare, g_pShareList[0]);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgE("Fail to set uri into ug service handle - [0x%x]",
+                       nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       nErr = app_control_set_operation(g_pServiceShare, pOperation);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgE("app_control_add_extra_data_array().. [0x%x]", nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       if (g_nShareListSize >= 1) {
+               nErr = app_control_add_extra_data_array(g_pServiceShare,
+                       "http://tizen.org/appcontrol/data/path",
+                       (const char
+                               **)(&g_pShareList[1]),
+                       g_nShareListSize - 1);
+               if (nErr != APP_CONTROL_ERROR_NONE) {
+                       gl_dbgW("[WARNING] app_control_add_extra_data_array() [0x%x]", nErr);
+                       goto ERROR_EXCEPTION;
+               }
+       }
+
+       nErr = app_control_send_launch_request(g_pServiceShare, NULL, NULL);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgW
+               ("[WARNING] app_control_send_launch_request().. [0x%x]", nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       g_bSharePanelLaunched = TRUE;
+
+       elm_naviframe_item_pop(ad->maininfo.naviframe);
+
+       return;
+
+ERROR_EXCEPTION:
+       if (g_pServiceShare) {
+               app_control_destroy(g_pServiceShare);
+               g_pServiceShare = NULL;
+       }
+
+       if (g_pShareList) {
+               for (nCounter = 0; nCounter < g_nShareListSize; nCounter++) {
+                       if (g_pShareList[nCounter]) {
+                               free(g_pShareList[nCounter]);
+                               g_pShareList[nCounter] = NULL;
+                       }
+               }
+               free(g_pShareList);
+               g_pShareList = NULL;
+       }
+
+}
+
+void gl_launching_thumbs_share_panel(void* data, int cnt)
+{
+       if (!data)
+               return;
+       gl_dbg("");
+       gl_appdata* ad = (gl_appdata*)data;
+
+       int nTotalVideoItem = 0;
+       int nTotalAppendedItem = 0;
+       int nExtraDataSize = 0;
+
+       g_nShareListSize = 0;
+       char** szFileUrlArrayForServiceExtraData = NULL;
+
+       nTotalVideoItem = cnt;
+       gl_dbg("nTotalVideoItem= %d", nTotalVideoItem);
+
+       if (nTotalVideoItem == 0)
+       {
+               gl_dbg("Nothing to share");
+               return;
+       }
+       nExtraDataSize = nTotalVideoItem;
+       if (nExtraDataSize) {
+               szFileUrlArrayForServiceExtraData =
+                       (char**)calloc(nExtraDataSize, sizeof(char*));
+
+               /** Store the list so the share panel can be updated later
+                *  g_pShareList size needs to bigger than total video size
+                *  because first url will be added twice, one for signal share and
+                *  one for multiple share.
+                *  so g_pShareList alloc size = nExtraDataSize + 1
+                */
+
+               g_pShareList = (char**)calloc((nExtraDataSize + 1), sizeof(char*));
+       }
+
+       /* Extract First URI. */
+       Eina_List* l = NULL;
+       gl_item* gitem = NULL;
+       Eina_List* itemlist = ad->selinfo.elist;
+       EINA_LIST_FOREACH(itemlist, l, gitem) {
+               if (!gitem->item->file_url) {
+                       gl_dbgE("file_url is not existed.");
+                       continue;
+               }
+               gl_dbg("file url %s", gitem->item->file_url);
+               g_pShareList[0] = strdup(gitem->item->file_url);
+               g_nShareListSize++;
+               break;
+       }
+
+       /* Extract another URI if existing selected items more. */
+       if (nExtraDataSize > 0 && szFileUrlArrayForServiceExtraData) {
+               gitem = NULL;
+               l = NULL;
+               EINA_LIST_FOREACH(itemlist, l, gitem) {
+                       if (gitem->item->file_url) {
+                               if (nTotalAppendedItem < nExtraDataSize) {
+                                       szFileUrlArrayForServiceExtraData[nTotalAppendedItem] = gitem->item->file_url;
+                                       gl_dbg("Appending share item : %s, Total Appended item : %d",
+                                               (const char**)szFileUrlArrayForServiceExtraData[nTotalAppendedItem],
+                                               nTotalAppendedItem);
+                                       nTotalAppendedItem++;
+
+                                       g_pShareList[g_nShareListSize++] = strdup(gitem->item->file_url);
+                                       continue;
+                               }
+                               else
+                               {
+                                       gl_dbgE("Less size is declared");
+                               }
+                       }
+                       else {
+                               gl_dbgE("file_url is not existed.");
+                       }
+               }
+       }
+
+       gl_create_launch_thumbs_share_panel(data);
+
+       gl_dbg("Launching share panel.");
+/*
+       int nCounter;
+       if (szFileUrlArrayForServiceExtraData) {
+               for (nCounter = 0; nCounter < nExtraDataSize; nCounter++) {
+                       if (szFileUrlArrayForServiceExtraData[nCounter]) {
+                               free(szFileUrlArrayForServiceExtraData[nCounter]);
+                               szFileUrlArrayForServiceExtraData[nCounter] = NULL;
+                       }
+               }
+               free(szFileUrlArrayForServiceExtraData);
+               szFileUrlArrayForServiceExtraData = NULL;
+       }*/
+
+       return;
+}
 
 /**
- * Delete the selected media
+ * share the selected media
  * @param data : App data
  */
-static void __gl_thumbs_edit_del(void *data)
+static void __gl_thumbs_edit_share(void *data)
 {
        GL_CHECK(data);
        gl_appdata *ad = (gl_appdata *) data;
@@ -49,11 +240,44 @@ static void __gl_thumbs_edit_del(void *data)
                        return;
                }
 
-               _gl_popup_create_del(data, GL_POPUP_DEL_FILE,
-                                                        _gl_data_selected_list_count,
-                                                        gl_del_medias, data);
+               gl_launching_thumbs_share_panel(data, cnt);
+
        } else {
-               gl_dbgW("Unknow mode!");
+               gl_dbgW("Unknown mode!");
+       }
+}
+
+/**
+ * Delete the selected media
+ * @param data : App data
+ */
+static void __gl_thumbs_edit_del(void* data)
+{
+       GL_CHECK(data);
+       gl_appdata* ad = (gl_appdata*)data;
+       gl_dbg("");
+
+       if (ad->uginfo.ug || ad->uginfo.b_app_called) {
+               gl_dbgW("UG or APP is already loaded!");
+               return;
+       }
+
+       int view_mode = gl_get_view_mode(ad);
+       if (view_mode == GL_VIEW_THUMBS_EDIT) {
+               int cnt = _gl_data_selected_list_count(ad);
+               if (cnt == 0) {
+                       gl_dbgW("No thumbs selected!");
+                       gl_popup_create_popup(ad, GL_POPUP_NOBUT,
+                               GL_STR_NO_FILES_SELECTED);
+                       return;
+               }
+
+               _gl_popup_create_del(data, GL_POPUP_DEL_FILE,
+                       _gl_data_selected_list_count,
+                       gl_del_medias, data);
+       }
+       else {
+               gl_dbgW("Unknown mode!");
        }
 }
 
@@ -86,7 +310,7 @@ static void __gl_thumbs_edit_copy_move(void *data)
                _gl_popup_create_copy_move(data, _gl_data_selected_list_count,
                                                                   data);
        } else {
-               gl_dbgW("Unknow mode!");
+               gl_dbgW("Unknown mode!");
        }
 }
 
@@ -122,6 +346,9 @@ static void __gl_thumbs_edit_done_cb(void *data, Evas_Object * obj,
        if (_gl_thumbs_get_edit_mode(data) == GL_THUMBS_EDIT_COPY
                || _gl_thumbs_get_edit_mode(data) == GL_THUMBS_EDIT_MOVE) {
                __gl_thumbs_edit_copy_move(ad);
+       }
+       else if (_gl_thumbs_get_edit_mode(data) == GL_THUMBS_EDIT_SHARE) {
+               __gl_thumbs_edit_share(ad);
        } else {
                __gl_thumbs_edit_del(ad);
        }
index 8cbfe18345e1c228bae68eab3f72940fd93c7a64..f8fee7a7e1b28ed383191b54d885140799978963 100755 (executable)
@@ -1049,6 +1049,41 @@ static void __gl_thumbs_edit_cb(void *data, Evas_Object * obj, void *ei)
        }
 }
 
+/**
+ * Perform share operation
+ * @param data : App data
+ * @param obj : grid object
+ * @param ei : event info
+ */
+static void __gl_thumbs_share_cb(void* data, Evas_Object* obj, void* ei)
+{
+       GL_CHECK(data);
+       gl_appdata* ad = (gl_appdata*)data;
+       _gl_ctxpopup_del(data);
+       if (ad->uginfo.ug || ad->gridinfo.is_append) {
+               gl_dbg("UG invoked or appending gridview.");
+               return;
+       }
+
+       ad->gridinfo.b_slideshow_disable = false;
+
+       int view_mode = gl_get_view_mode(data);
+       gl_dbg("mode: %d", view_mode);
+       if (view_mode == GL_VIEW_THUMBS) {
+               _gl_thumbs_set_edit_mode(data, GL_THUMBS_EDIT_SHARE);
+               gl_item* gitem = eina_list_nth(ad->gridinfo.medias_elist, 0);
+               gl_item* tmp = NULL;
+               if (gitem && gitem->album) {
+                       EINA_LIST_FREE(gitem->album->elist, tmp) {
+                               if (tmp) {
+                                       tmp->checked = false;
+                               }
+                       }
+               }
+               _gl_thumbs_edit_create_view(data);
+       }
+}
+
 /**
  * Perform copy operation
  * @param data : App data
@@ -1153,6 +1188,12 @@ static int __gl_thumbs_ctxpopup_append(void *data, Evas_Object * parent)
        if (!_gl_thumbs_check_zero(data))
                _gl_ctxpopup_append(parent, GL_STR_ID_DELETE,
                                                        __gl_thumbs_edit_cb, data);
+
+       /* 3. Share */
+       if (!_gl_thumbs_check_zero(data))
+               _gl_ctxpopup_append(parent, GL_STR_ID_SHARE,
+                       __gl_thumbs_share_cb, data);
+
        /* 4. Copy to album */
        if (!_gl_thumbs_check_zero(data))
                _gl_ctxpopup_append(parent, GL_STR_ID_COPY_TO_ALBUM,
index c096704494db9070e0510608da9bd568d9139e9e..240fb34d2177d896d58fa1902f02833dd1954a1b 100755 (executable)
@@ -61,6 +61,7 @@ typedef enum _gl_zoom_mode_t {
 typedef enum _gl_tl_view_t {
        GL_TL_VIEW_NORMAL,
        GL_TL_VIEW_EDIT,
+       GL_TL_VIEW_SHARE,
        GL_TL_VIEW_COPY,
 } gl_tl_view_e;
 
@@ -123,6 +124,11 @@ typedef struct _gl_date_item_data_t {
        bool check_state;
 } _gl_date_item_data;
 
+static app_control_h g_pServiceShare = NULL;
+static char** g_pShareList = NULL;
+static int g_nShareListSize = 0;
+static bool g_bSharePanelLaunched = FALSE;
+
 int _get_count_of_items_on_same_date(gl_media_s * item, Eina_List * list,
                                                                         char **text, int start_index);
 int _gl_time_get_number_of_items_per_row(void *data);
@@ -786,7 +792,7 @@ static void __gl_timeline_date_check_sel_cb(void *data, Evas_Object * obj,
        int mode = timeline_d->view_m;
        Elm_Object_Item *it = (Elm_Object_Item *) ei;
        elm_genlist_item_selected_set(it, EINA_FALSE);
-       if (!(mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY)) {
+       if (!(mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY || mode == GL_TL_VIEW_SHARE)) {
                gl_dbgE("not edit mode");
                return;
        }
@@ -1229,7 +1235,7 @@ static Evas_Object *__gl_timeline_thumbs_get_content(void *data,
                return layout;
        } else if (!g_strcmp0(part, GL_THUMB_CHECKBOX)) {
                Evas_Object *ck = NULL;
-               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY) {
+               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY || mode == GL_TL_VIEW_SHARE) {
                        ck = elm_check_add(obj);
                        GL_CHECK_NULL(ck);
 
@@ -1250,7 +1256,7 @@ static Evas_Object *__gl_timeline_thumbs_get_content(void *data,
                return ck;
        } else if (!g_strcmp0(part, "elm_image_open_icon_swallow_blocker")) {
                Evas_Object *btn1 = NULL;
-               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY) {
+               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY  || mode == GL_TL_VIEW_SHARE) {
                        btn1 = evas_object_rectangle_add(evas_object_evas_get(obj));
                        evas_object_color_set(btn1, 0, 255, 0, 0);
                        evas_object_propagate_events_set(btn1, EINA_FALSE);
@@ -1265,7 +1271,7 @@ static Evas_Object *__gl_timeline_thumbs_get_content(void *data,
                return btn1;
        } else if (!g_strcmp0(part, "elm_image_open_icon_swallow")) {
                Evas_Object *btn = NULL;
-               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY) {
+               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY || mode == GL_TL_VIEW_SHARE) {
                        btn = elm_button_add(obj);
                        elm_object_style_set(btn, "transparent");
                        evas_object_show(btn);
@@ -1532,7 +1538,7 @@ static Evas_Object *__gl_get_date_check(const void
        if (!g_strcmp0(pPart, "select.all.data.check")) {
 
                Evas_Object *ck = NULL;
-               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY) {
+               if (mode == GL_TL_VIEW_EDIT || mode == GL_TL_VIEW_COPY || mode == GL_TL_VIEW_SHARE) {
                        ck = elm_check_add(pObject);
                        GL_CHECK_NULL(ck);
 
@@ -1720,7 +1726,8 @@ int _gl_timeline_create_grid_view(gl_timeline_s * timeline_d,
                _gl_data_get_items(-1, -1, &list);
                _gl_time_finialize_media_data(timeline_d);
                if (timeline_d->view_m == GL_TL_VIEW_EDIT
-                       || timeline_d->view_m == GL_TL_VIEW_COPY) {
+                       || timeline_d->view_m == GL_TL_VIEW_COPY
+                       || timeline_d->view_m == GL_TL_VIEW_SHARE) {
                        _gl_time_update_selected_media(timeline_d, list);
                }
                timeline_d->data_list = list;
@@ -2089,6 +2096,29 @@ static void __gl_timeline_edit_cb(void *data, Evas_Object * obj, void *ei)
        __gl_timeline_change_mode(data, GL_TL_VIEW_EDIT);
 }
 
+/**
+ * Create time share view
+ * @param data : App data
+ * @param obj : Context popup object
+ * @param ei : event info
+ */
+
+static void __gl_timeline_share_cb(void* data, Evas_Object* obj, void* ei)
+{
+       GL_CHECK(data);
+       gl_appdata* ad = (gl_appdata*)data;
+       _gl_ctxpopup_del(data);
+       if (ad->uginfo.ug) {
+               /**
+               * Prevent changed to edit view in wrong way.
+               * 1. When invoke imageviewer UG;
+               */
+               gl_dbgW("UG invoked!");
+               return;
+       }
+       __gl_timeline_change_mode(data, GL_TL_VIEW_SHARE);
+}
+
 /**
  * start time view copy operation
  * @param data : App data
@@ -2464,6 +2494,9 @@ static int __gl_timeline_ctxpopup_append(void *data, Evas_Object * parent)
                /* Delete */
                _gl_ctxpopup_append(parent, GL_STR_ID_DELETE,
                                                        __gl_timeline_edit_cb, data);
+               /* Share*/
+               _gl_ctxpopup_append(parent, GL_STR_ID_SHARE,
+                                                       __gl_timeline_share_cb, data);
                /* Copy to album */
                _gl_ctxpopup_append(parent, GL_STR_ID_COPY_TO_ALBUM,
                                                        __gl_timeline_copy_cb, data);
@@ -2629,6 +2662,229 @@ static int __gl_timeline_add_btns(void *data)
        return 0;
 }
 
+static void gl_create_launch_share_panel(void* data)
+{
+       if(!data)
+               return;
+       gl_appdata* ad = (gl_appdata*)data;
+
+       char* pOperation = "http://tizen.org/appcontrol/operation/share";
+       int nCounter;
+       int nErr = 0;
+
+       if (g_nShareListSize > 1) {
+               pOperation = "http://tizen.org/appcontrol/operation/multi_share";
+       }
+
+       if (!g_pShareList) {
+               gl_dbgW("[WARNING] Fail to get uri at first.");
+               goto ERROR_EXCEPTION;
+       }
+
+       if (!g_pServiceShare) {
+               nErr = app_control_create(&g_pServiceShare);
+               if (nErr != APP_CONTROL_ERROR_NONE) {
+                       gl_dbgE("Fail to create ug service handle - [0x%x]",
+                               nErr);
+                       goto ERROR_EXCEPTION;
+               }
+       }
+
+       nErr = app_control_set_uri(g_pServiceShare, g_pShareList[0]);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgE("Fail to set uri into ug service handle - [0x%x]",
+                       nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       nErr = app_control_set_operation(g_pServiceShare, pOperation);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgE("app_control_add_extra_data_array().. [0x%x]", nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       if (g_nShareListSize >= 1) {
+               nErr = app_control_add_extra_data_array(g_pServiceShare,
+                       "http://tizen.org/appcontrol/data/path",
+                       (const char
+                               **)(&g_pShareList[1]),
+                       g_nShareListSize - 1);
+               if (nErr != APP_CONTROL_ERROR_NONE) {
+                       gl_dbgW("[WARNING] app_control_add_extra_data_array() [0x%x]", nErr);
+                       goto ERROR_EXCEPTION;
+               }
+       }
+
+       nErr = app_control_send_launch_request(g_pServiceShare, NULL, NULL);
+       if (nErr != APP_CONTROL_ERROR_NONE) {
+               gl_dbgW
+               ("[WARNING] app_control_send_launch_request().. [0x%x]", nErr);
+               goto ERROR_EXCEPTION;
+       }
+
+       g_bSharePanelLaunched = TRUE;
+
+       elm_naviframe_item_pop(ad->maininfo.naviframe);
+
+       return;
+
+ERROR_EXCEPTION:
+       if (g_pServiceShare) {
+               app_control_destroy(g_pServiceShare);
+               g_pServiceShare = NULL;
+       }
+
+       if (g_pShareList) {
+               for (nCounter = 0; nCounter < g_nShareListSize; nCounter++) {
+                       if (g_pShareList[nCounter]) {
+                               free(g_pShareList[nCounter]);
+                               g_pShareList[nCounter] = NULL;
+                       }
+               }
+               free(g_pShareList);
+               g_pShareList = NULL;
+       }
+
+}
+
+void gl_launching_share_panel(void* data, int cnt)
+{
+       if(!data)
+               return;
+       gl_dbg("");
+       gl_appdata* ad = (gl_appdata*)data;
+       if(!ad->tlinfo)
+       {
+               gl_dbgE("ad->tlinfo not found");
+               return;
+       }
+       gl_timeline_s* timeline_d = ad->tlinfo;
+       if(!timeline_d->sel_d)
+       {
+               gl_dbgE("sel_d not found");
+               return;
+       }
+
+       int nCounter = 0;
+       int nTotalVideoItem = 0;
+       int nTotalAppendedItem = 0;
+       int nExtraDataSize = 0;
+
+       g_nShareListSize = 0;
+       char** szFileUrlArrayForServiceExtraData = NULL;
+
+       nTotalVideoItem =cnt;
+       gl_dbg("nTotalVideoItem= %d",nTotalVideoItem);
+
+       if (nTotalVideoItem == 0)
+       {
+               gl_dbg("Nothing to share");
+               return;
+       }
+       nExtraDataSize = nTotalVideoItem;
+       if (nExtraDataSize) {
+               szFileUrlArrayForServiceExtraData =
+                       (char**)calloc(nExtraDataSize, sizeof(char*));
+
+               /** Store the list so the share panel can be updated later
+                *  g_pShareList size needs to bigger than total video size
+                *  because first url will be added twice, one for signal share and
+                *  one for multiple share.
+                *  so g_pShareList alloc size = nExtraDataSize + 1
+                */
+
+               g_pShareList = (char**)calloc((nExtraDataSize + 1), sizeof(char*));
+       }
+
+       Eina_List *l = NULL;
+       char *item = NULL;
+       gl_media_s * gitem=NULL;
+       int i;
+       for(i=0;i<cnt;i++)
+       {
+               item=eina_list_nth(timeline_d->sel_d->sel_list, i);
+               if(!item)
+               {
+                       continue;
+               }
+               gl_dbg("list print %s",item);
+               EINA_LIST_FOREACH(timeline_d->data_list, l, gitem) {
+                       if(!gitem){
+                               continue;}
+                       if(!strcmp(item,gitem->uuid))
+                       {
+                               gl_dbg("file url %s",gitem->file_url);
+                               break;
+                       }
+               }
+       }
+
+       /* Extract First URI. */
+       for (nCounter = 0; nCounter < nTotalVideoItem; nCounter++) {
+
+                       char* szFileUrl = _gl_get_media_url(timeline_d->sel_d->sel_list,nCounter);
+
+                       if (szFileUrl) {
+                               nCounter++;
+                               g_pShareList[0] = strdup(szFileUrl);
+                               g_nShareListSize++;
+                               break;
+                       }
+                       else {
+                               gl_dbgE("szFileUrl is not existed.");
+                       }
+                       free(szFileUrl);
+       }
+
+       gl_dbg("nCounter = %d", nCounter);
+
+       /* Extract another URI if existing selected items more. */
+       if (nExtraDataSize > 0 && szFileUrlArrayForServiceExtraData) {
+               for (nCounter = 0; nCounter < nTotalVideoItem; nCounter++) {
+
+                               char* szFileUrl = _gl_get_media_url(timeline_d->sel_d->sel_list, nCounter);
+
+                               if (szFileUrl) {
+                                       if (nTotalAppendedItem < nExtraDataSize) {
+                                               szFileUrlArrayForServiceExtraData[nTotalAppendedItem] = szFileUrl;
+                                               gl_dbg("Appending share item : %s, Total Appended item : %d",
+                                                       (const char**)szFileUrlArrayForServiceExtraData[nTotalAppendedItem],
+                                                       nTotalAppendedItem);
+                                               nTotalAppendedItem++;
+
+                                               g_pShareList[g_nShareListSize++] = strdup(szFileUrl);
+                                               continue;
+                                       }
+                                       else {
+                                               gl_dbgW("[WARNING] OVERFLOW ALOOCATED MEMORY SIZE.");
+                                               free(szFileUrl);
+                                       }
+                               }
+                               else {
+                                       gl_dbgE("szFileUrl is not existed.");
+                               }
+                       }
+               }
+
+       gl_create_launch_share_panel(data);
+
+       gl_dbg("Launching share panel.");
+
+
+       if (szFileUrlArrayForServiceExtraData) {
+               for (nCounter = 0; nCounter < nExtraDataSize; nCounter++) {
+                       if (szFileUrlArrayForServiceExtraData[nCounter]) {
+                               free(szFileUrlArrayForServiceExtraData[nCounter]);
+                               szFileUrlArrayForServiceExtraData[nCounter] = NULL;
+                       }
+               }
+               free(szFileUrlArrayForServiceExtraData);
+               szFileUrlArrayForServiceExtraData = NULL;
+       }
+
+       return;
+}
+
 /**
  * Media delete CB
  * @param data : App data
@@ -2658,7 +2914,11 @@ static void __gl_timeline_del_cb(void *data, Evas_Object * obj, void *ei)
        if (ad->tlinfo->view_m == GL_TL_VIEW_COPY) {
                gl_dbg("copy operation from time view");
                _gl_popup_create_copy_move(data, __gl_timeline_get_sel_cnt, data);
-       } else {
+       }
+       else if(ad->tlinfo->view_m == GL_TL_VIEW_SHARE){
+               gl_dbg("share operation from time view");
+               gl_launching_share_panel(data, cnt);
+       }else {
                _gl_db_update_lock_always(data, true);
                _gl_set_file_op_cbs(data, __gl_timeline_del_op, NULL,
                                                        __gl_timeline_update_del_view, cnt);
@@ -2827,13 +3087,14 @@ static int __gl_timeline_change_mode(void *data, int mode)
                GL_GFREEIF(ad->tlinfo->sel_d);
                break;
        case GL_TL_VIEW_EDIT:
+       case GL_TL_VIEW_SHARE:
        case GL_TL_VIEW_COPY:
                GL_GFREEIF(ad->tlinfo->sel_d);
                ad->tlinfo->sel_d = g_new0(gl_sel_s, 1);
                GL_CHECK_VAL(ad->tlinfo->sel_d, -1);
                _gl_ui_change_navi_title(ad->tlinfo->nf_it, GL_STR_ID_SELECT_ITEM,
                                                                 false);
-               if (GL_TL_VIEW_EDIT == mode || GL_TL_VIEW_COPY == mode) {
+               if (GL_TL_VIEW_EDIT == mode || GL_TL_VIEW_COPY == mode || GL_TL_VIEW_SHARE == mode) {
                        __gl_timeline_edit_add_btns(data);
                }
                break;
@@ -3164,7 +3425,8 @@ int _gl_timeline_view_rotate(void *data)
                                                           "");
        }
        if (ad->tlinfo->view_m == GL_TL_VIEW_EDIT
-               || ad->tlinfo->view_m == GL_TL_VIEW_COPY) {
+               || ad->tlinfo->view_m == GL_TL_VIEW_COPY
+               || ad->tlinfo->view_m == GL_TL_VIEW_SHARE) {
                elm_object_signal_emit(ad->ctrlinfo.ctrlbar_view_ly,
                                                           "elm,selectall,state,visible,bg", "elm");
                elm_object_signal_emit(ad->ctrlinfo.ctrlbar_view_ly,
@@ -3382,3 +3644,19 @@ bool _gl_is_timeline_edit_copy_mode(void *data)
        }
        return false;
 }
+
+/**
+ * Gets if mode is  time edit share mode
+ * @param data : App data
+ * @return
+ */
+bool _gl_is_timeline_edit_share_mode(void* data)
+{
+       GL_CHECK_FALSE(data);
+       gl_appdata* ad = (gl_appdata*)data;
+       GL_CHECK_FALSE(ad->tlinfo);
+       if (ad->tlinfo->view_m == GL_TL_VIEW_SHARE) {
+               return true;
+       }
+       return false;
+}
old mode 100644 (file)
new mode 100755 (executable)
index b826c4e..3898af2
@@ -875,7 +875,7 @@ int _gl_local_data_get_album_media_list(gl_filter_s * condition,
        ret = media_folder_foreach_media_from_db(album_id, filter,
                                                                                         __gl_local_data_get_media_list_cb,
                                                                                         &tran_data);
-       gl_dbg("Get medias--start");
+       gl_dbg("Get medias--end");
 
        __gl_local_data_destroy_filter(filter);
 
index a2a8dd5317b2a5e0e6c11c6dbc5a8769ddd82239..456d0b48d1c4d85d7ce1cfc97cb2b50bb430c482 100755 (executable)
@@ -665,6 +665,50 @@ int _gl_move_media_thumb(void *data, gl_item * gitem, char *new_dir_name,
        }
 }
 
+char* _gl_get_media_url(Eina_List* medialist, int index)
+{      
+       media_info_h media_h = NULL;
+       int ret = -1;
+       char* path = NULL;
+       gl_dbg("");
+
+       if (!medialist)
+       {
+               gl_dbgE("no list");
+               goto GL_DONE;
+       }
+
+       const char* uuid=eina_list_nth(medialist, index);
+       gl_dbg("%s",uuid);
+       if(!uuid)
+       {
+               gl_dbgE("Get uuid failed!");
+               goto GL_DONE;
+       }
+
+
+       ret = media_info_get_media_from_db(uuid, &media_h);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               gl_dbgE("Get media failed[%d]!", ret);
+               goto GL_DONE;
+       }
+
+       ret = media_info_get_file_path(media_h, &path);
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               gl_dbgE("Get media file path failed!");
+               goto GL_DONE;
+       }
+       gl_dbg("path is %s",path);
+       return path;
+
+GL_DONE:
+       GL_FREEIF(path);
+       if (media_h) {
+               media_info_destroy(media_h);
+       }
+       return NULL;
+}
+
 /**
  * Used for loal medias, thumbnail was moved to new dest first, then rename file
  * @param data