fix for rsa
authorJisung Ahn <jcastle.ahn@samsung.com>
Fri, 14 Dec 2012 13:36:18 +0000 (22:36 +0900)
committerJisung Ahn <jcastle.ahn@samsung.com>
Fri, 14 Dec 2012 13:36:18 +0000 (22:36 +0900)
Change-Id: I48e9ec132e06f10b63081c76da202e9c117d94b6

common/src/ivug-util.c
main/src/include/ivug-crop-view.h
main/src/view/ivug-crop-view.cpp
main/src/view/ivug-main-view-menu.cpp
main/src/view/ivug-main-view.cpp
main/src/view/ivug-name-view.c

index ff662fc..1aef79b 100755 (executable)
@@ -622,3 +622,22 @@ ivug_get_icu_date(time_t mtime)
 
 }
 
+bool ivug_validate_file_name(const char *fname)
+{
+       if (!fname)
+               return false;
+
+       const char badchar[] = "\\/;:*?<>|\"";
+       const char *tmp = fname;
+
+       /* check bad character */
+       while (*tmp != '\0') {
+               if (strchr(badchar, *tmp) != NULL) {
+                       MSG_UTIL_HIGH("Invalid file name=%s char=%c", fname, *tmp);
+                       return false;
+               }
+               tmp++;
+       }
+       return true;
+}
+
index 06ade6f..4ebf6a1 100755 (executable)
@@ -37,8 +37,6 @@ typedef struct {
 
        Evas_Object *gesture;
 
-       Evas_Object *btn_back;
-
        Evas_Object *contents_area;
        Evas_Object *notify_area;
        Evas_Object *btn_ok;
@@ -58,6 +56,8 @@ typedef struct {
        int prev_w;
        int prev_h;
 
+       Ecore_Timer *box_timer;
+
 } IvugCropView;
 
 /*
@@ -72,6 +72,9 @@ typedef struct {
 extern "C" {
 #endif
 
+/* this api is for trasition */
+void _ivug_crop_view_box_delete(IvugCropView *pCropView);
+
 IvugCropView *ivug_crop_view_create(Evas_Object *parent);
 
 bool ivug_crop_view_box_size_set(IvugCropView *pCropView, int w, int h);
index 2cc8532..7417de0 100755 (executable)
@@ -136,14 +136,12 @@ void  _on_test(void *data, Evas_Object *obj, void *event_info)
        MSG_HIGH("Test signal received");
 }
 
-void  _on_preloaded(void *data, Evas_Object *obj, void *event_info)
+static Eina_Bool _on_box_timer_expired(void *data)
 {
-       IV_ASSERT(data != NULL);
+       ivug_retv_if(!data, ECORE_CALLBACK_CANCEL);
 
        IvugCropView *pCropView = static_cast<IvugCropView *>(data);
 
-       MSG_HIGH("Image preloaded");
-
        int x, y, w, h;
        ivug_image_region_get(pCropView->photocam,  &x, &y, &w, &h);
 
@@ -164,11 +162,44 @@ void  _on_preloaded(void *data, Evas_Object *obj, void *event_info)
 
        int nW = 0;
        int nH = 0;
+       double ratio = 0.0;
 
        if(pCropView->w > 0 && pCropView->h > 0)
        {
                nW = pCropView->w;
                nH = pCropView->h;
+               ratio = (double)nH/nW;
+               MSG_HIGH("hW : %d, nH : %d, ratio : %f", nW, nH, ratio);
+               if(ratio > 1.0) //height is more longer
+               {
+                       if(nH > h)
+                       {
+                               nH = h;
+                               nW = h/ratio;
+                               MSG_HIGH("Calculated1 : %d,%d", nW, nH);
+                       }
+                       if(nW > w)
+                       {
+                               nW = w;
+                               nH = w*ratio;
+                               MSG_HIGH("Calculated2 : %d,%d", nW, nH);
+                       }
+               }
+               else //width is more longer
+               {
+                       if(nH > h)
+                       {
+                               nH = h;
+                               nW = h/ratio;
+                               MSG_HIGH("Calculated3 : %d,%d", nW, nH);
+                       }
+                       if(nW > w)
+                       {
+                               nW = w;
+                               nH = w*ratio;
+                               MSG_HIGH("Calculated4 : %d,%d", nW, nH);
+                       }
+               }
        }
        else
        {
@@ -176,8 +207,27 @@ void  _on_preloaded(void *data, Evas_Object *obj, void *event_info)
                nH = h / 2;
        }
 
+       MSG_HIGH("Calculated : %d,%d", nW, nH);
+
        ivug_scissorbox_region_set(pCropView->cropbox, x + (w - nW) / 2, y + (h - nH) / 2, nW, nH);
 
+       elm_object_disabled_set(pCropView->btn_ok, EINA_FALSE);
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void  _on_preloaded(void *data, Evas_Object *obj, void *event_info)
+{
+       IV_ASSERT(data != NULL);
+
+       IvugCropView *pCropView = static_cast<IvugCropView *>(data);
+
+       MSG_HIGH("Image preloaded");
+
+       if(pCropView->box_timer)
+               ecore_timer_del(pCropView->box_timer);
+       pCropView->box_timer = ecore_timer_add(0.3, _on_box_timer_expired, data);
+
        Evas_Object *object = elm_object_part_content_unset(pCropView->layout, "thumbnail");
        if(object != NULL)
        {
@@ -189,8 +239,6 @@ void  _on_preloaded(void *data, Evas_Object *obj, void *event_info)
 
        pCropView->notify = ivug_notify_static_create(pCropView->notify_area, IDS_CROP_NOTIFY, NOTIFY_ALIGN_BOTTOM);
 
-       elm_object_disabled_set(pCropView->btn_ok, EINA_FALSE);
-
        evas_object_show(pCropView->photocam);
 }
 
@@ -345,10 +393,10 @@ static void _on_btn_cancel(void *data, Evas_Object *obj, void *event_info)
 
        MSG_HIGH("Cancel clicked");
 
-       evas_object_smart_callback_call(pCropView->layout, "destroyed", NULL);
-
        evas_object_smart_callback_call(pCropView->layout, "cancel,clicked", NULL);
 
+       evas_object_smart_callback_call(pCropView->layout, "destroyed", NULL);
+
        ivug_crop_view_destroy(pCropView);
 }
 
@@ -405,6 +453,18 @@ void _add_gesture_layer(Evas_Object *parent, IvugCropView *pCropView)
        evas_object_name_set(gesture, "Crop:Getsture");
 }
 
+void _ivug_crop_view_box_delete(IvugCropView *pCropView)
+{
+       IV_ASSERT(pCropView != NULL);
+
+       if ( pCropView->cropbox)
+       {
+               evas_object_del(pCropView->cropbox);
+               pCropView->cropbox = NULL;
+       }
+
+       return;
+}
 
 IvugCropView *ivug_crop_view_create(Evas_Object *parent)
 {
@@ -521,6 +581,11 @@ void ivug_crop_view_destroy(IvugCropView *pCropView)
 
        MSG_HIGH("Destroy CropView");
 
+       if(pCropView->box_timer)
+       {
+               ecore_timer_del(pCropView->box_timer);
+               pCropView->box_timer = NULL;
+       }
 
        if ( pCropView->file_path )
        {
@@ -570,10 +635,10 @@ void ivug_crop_view_destroy(IvugCropView *pCropView)
                pCropView->contents_area = NULL;
        }
 
-       if(pCropView->btn_back)
+       if(pCropView->btn_ok)
        {
-               evas_object_del(pCropView->btn_back);
-               pCropView->btn_back = NULL;
+               evas_object_del(pCropView->btn_ok);
+               pCropView->btn_ok = NULL;
        }
 
        if ( pCropView->notify)
index c77a448..5782cca 100755 (executable)
@@ -249,18 +249,31 @@ void _on_share_selected(void *data, Evas_Object *obj, void *event_info)
        evas_object_del(obj);
 }
 
+static void  _ivug_crop_view_transit_finished_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Ivug_MainView *pMainView = (Ivug_MainView *)data;
+
+       ivug_crop_view_destroy(pMainView->pCropView);
+
+       pMainView->pCropView = NULL;
+
+       evas_object_smart_callback_del(pMainView->navi_bar, "transition,finished",
+                       _ivug_crop_view_transit_finished_cb);
+}
+
 static void  _ivug_crop_view_destroyed_cb(void *data, Evas_Object *obj, void *event_info)
 {
        Ivug_MainView *pMainView = (Ivug_MainView *)data;
 
        ivug_main_view_set_hide_timer(pMainView);
 
-       elm_naviframe_item_pop(pMainView->navi_bar);
-       pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
+       evas_object_smart_callback_add(pMainView->navi_bar, "transition,finished",
+                       _ivug_crop_view_transit_finished_cb, pMainView);
 
-       ivug_crop_view_destroy(pMainView->pCropView);
+       _ivug_crop_view_box_delete(pMainView->pCropView);
 
-       pMainView->pCropView = NULL;
+       elm_naviframe_item_pop(pMainView->navi_bar);
+       pMainView->navi_it = elm_naviframe_top_item_get(pMainView->navi_bar);
 
        elm_naviframe_item_title_visible_set(pMainView->navi_it, EINA_TRUE);
 }
@@ -342,6 +355,7 @@ static void _ivug_setas_view_ok_clicked_cb(void *data, Evas_Object *obj, void *e
 static void _create_setas_view(Ivug_MainView *pMainView, const char *filepath, ivug_set_screen_type type)
 {
        IvugCropView *pCropView = ivug_crop_view_create(pMainView->layout);
+
        int lcd_x = 0;
        int lcd_y = 0;
        int lcd_w = 0;
@@ -1074,10 +1088,10 @@ _ivug_detail_view_rename_clicked_cb(void *data, Evas_Object *obj, void *event_in
 
        ivug_name_view_set_entry(pMainView->pNameView, name);
 
-       ivug_name_view_set_response_callback(pMainView->pNameView, _on_rename_view_response, (void*)pMainView);
-
        free(name);
 
+       ivug_name_view_set_response_callback(pMainView->pNameView, _on_rename_view_response, (void*)pMainView);
+
        Evas_Object *layout = ivug_name_view_object_get(pMainView->pNameView);
 
        pMainView->navi_it = elm_naviframe_item_push(pMainView->navi_bar, NULL, NULL, NULL, layout, NULL);
index 78a1560..83e6580 100755 (executable)
@@ -1460,7 +1460,12 @@ ivug_main_view_resume(Ivug_MainView *pMainView)
        }
 
 // When resume, menu bar will be appeared.
-       ivug_main_view_show_menu_bar(pMainView);
+       if(!(pMainView->pNameView
+               || pMainView->pSetAsView
+               || pMainView->pCropView))       //child view is not exist
+       {
+               ivug_main_view_show_menu_bar(pMainView);
+       }
 
        ivug_slider_resume(pMainView->slider);
 }
index 4ecc583..8af7509 100755 (executable)
@@ -23,6 +23,8 @@
 #include "ivug-media.h"
 #include "ivug-vibration.h"
 
+#include "ivug-util.h"
+
 #define MAX_BYTE_LEN 256-1
 
 #define CONTROL_ICON_DIRECTORY_PATH    IMAGE_PATH"/01_Control icon"