1. Added 'Home and lock screen option' 2. Solved crop crash issue
authorchitta ranjan <chitta.rs@samsung.com>
Mon, 1 Apr 2013 09:48:54 +0000 (18:48 +0900)
committerchitta ranjan <chitta.rs@samsung.com>
Mon, 1 Apr 2013 11:40:07 +0000 (20:40 +0900)
Change-Id: Ie3d81a5dc933e3c8fe2f36c21b54af630baea2c5
Signed-off-by: chitta ranjan <chitta.rs@samsung.com>
inc/IvImageViewerForm.h
inc/IvImageViewerPresentationModel.h
inc/IvTypes.h
res/screen-size-normal/IDL_FORM_NAME_EDITOR.xml
src/IvImageCropForm.cpp
src/IvImageInfo.cpp
src/IvImageNameEditorForm.cpp
src/IvImageSetterForm.cpp
src/IvImageViewerForm.cpp
src/IvImageViewerPresentationModel.cpp

index 239beb1..d5f1557 100644 (file)
@@ -127,6 +127,12 @@ private:
                , APPCONTROL_MODE_EMAIL
        };
 
+       enum RotateMode
+       {
+               ROTATE_MODE_RIGHT = 0
+         , ROTATE_MODE_LEFT
+       };
+
        void InitializeDisplay(AppControlMode status);
        void InitShowGallery(void);
        void CreateGallery(void);
@@ -145,6 +151,7 @@ private:
        long long GetFileSize(Tizen::Base::String filePath);
        void GetHeaderString(int index, Tizen::Base::String& fileName, Tizen::Base::String& page);
        void DownloadFile(void);
+       void RotateImage(Tizen::Base::String& filePath, RotateMode rotateMode);
        void CallVideoPlayer(void);
        result DeleteImageFile(void);
        void RequestDecodeUrl(void);
index 1c23c82..0266912 100644 (file)
@@ -72,6 +72,8 @@ public:
        int GetSetterIndex(void) const;
        void SetSetterIndex(const int index);
 
+       void SetImageRotateStatus(bool value);
+
        int GetDurationOfSlideShow(void) const;
        SlideShowTransitionEffect GetTransitionEffectOfSlideShow(void) const;
 
@@ -95,6 +97,7 @@ private:
 
        void LoadSettingValue();
        int GetImageCacheIndex(const Tizen::Base::String &path);
+       bool GetImageRotateStatus(void) const;
 
 private:
        static ImageViewerPresentationModel* __pPresentationModelInstance;
@@ -111,6 +114,7 @@ private:
        SlideShowTransitionEffect __transitionEffectOfSlideShow;
        Tizen::Io::FileEventManager* __pFileEventManager;
        SettingPresentationModel* __pSettingPresentationModel;
+       bool __isImageRotated;
 };
 
 #endif /* _IV_VIEWER_PRESENTATION_MODEL_H_ */
index fa8a967..53ef279 100644 (file)
@@ -34,13 +34,14 @@ enum SetterPressedStatus
          SET_AT_TYPE_HOME_SCREEN_WALLPAPER = 1
        , SET_AT_TYPE_CALLER_IMAGE
        , SET_AT_TYPE_LOCK_SCREEN_WALLPAPER
+       , SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER
 };
 
 enum ActionID
 {
          ACTION_ID_FORM_IMAGE = 101
        , ACTION_ID_BUTTON_EDITFIELD_CANCEL = 201
-       , ACTION_ID_BUTTON_EDITFIELD_DONE = 202
+       , ACTION_ID_BUTTON_EDITFIELD_SAVE = 202
        , ACTION_ID_CONTEXTMENU_CALLER = 301
        , ACTION_ID_CONTEXTMENU_COPY = 302
        , ACTION_ID_CONTEXTMENU_EMAIL = 303
@@ -59,8 +60,11 @@ enum ActionID
        , ACTION_ID_FOOTER_BUTTON_SHARE = 408
        , ACTION_ID_FOOTER_BUTTON_SAVE = 409
        , ACTION_ID_FOOTER_BUTTON_CROP = 412
+       , ACTION_ID_FOOTER_BUTTON_ROTATE_LEFT = 413
+       , ACTION_ID_FOOTER_BUTTON_ROTATE_RIGHT = 414
        , ACTION_ID_FOOTER_MORE = 501
        , ACTION_ID_PANEL_HEADER_DETAILS_RENAME = 601
+       , ACTION_ID_CONTEXTMENU_HOME_AND_LOCK = 602
 };
 
 enum SlideShowTransitionEffect
index 6bdc8a1..6cca1a5 100644 (file)
@@ -3,20 +3,24 @@
        This XML file was automatically generated by UiBuilder - do not modify by hand.
 -->
 <!DOCTYPE Scene SYSTEM "UIForm.dtd">
-<Scene Bversion="2.0.0.201302250945" Dversion="20120315">
+<Scene Bversion="2.0.0.201303280947" Dversion="20120315">
     <LogicalCoordinate>720</LogicalCoordinate>
     <Form id="IDL_FORM_NAME_EDITOR">
-        <property backgroundColor="" backgroundColorOpacity="100" orientation="Automatic" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
-        <layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER" type="LAYOUT_RELATIVE"/>
-        <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER" type="LAYOUT_RELATIVE"/>
+        <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Automatic" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
+        <layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
+        <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
     </Form>
+    <Footer>
+        <property backgroundBitmapPath="" color="" colorOpacity="100" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_ICON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" showBackButton="false"/>
+        <itemSet/>
+    </Footer>
     <Header>
-        <property backgroundBitmapPath="" color="" colorOpacity="100" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" titleIconPath="" titleText="" titleTextColor=""/>
+        <property accessibilityHint="" backgroundBitmapPath="" color="" colorOpacity="100" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" titleIconPath="" titleText="" titleTextColor=""/>
         <itemSet/>
     </Header>
     <EditField id="IDC_EDITFIELD_NAME" parent="IDL_FORM_NAME_EDITOR">
-        <property commandButtonVisible="true" disabledBGBitmapPath="" disabledColor="" disabledColorOpacity="100" disabledTextColor="" ellipsisPosition="ELLIPSIS_POSITION_END" enableClear="true" groupStyle="GROUP_STYLE_NONE" guideText="" guideTextColor="" highlightedBGBitmapPath="" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalMargin="16" inputStyle="INPUT_STYLE_OVERLAY" keypadAction="KEYPAD_ACTION_ENTER" keypadEnabled="true" limitLength="255" linkTextColor="" lowerCaseMode="false" normalBGBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="" pressedColor="" pressedColorOpacity="100" text="" textHorizontalAlignment="ALIGNMENT_LEFT" textSize="45" titleStyle="EDIT_FIELD_TITLE_STYLE_NONE" titleText="" titleTextColor="" verticalMargin="12" viewMode="false"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="100" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDL_FORM_NAME_EDITOR" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Portrait" rightRelation="IDL_FORM_NAME_EDITOR" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" style="EDIT_FIELD_STYLE_NORMAL" topRelation="IDL_FORM_NAME_EDITOR" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="720" x="0" y="0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="120" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDL_FORM_NAME_EDITOR" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Landscape" rightRelation="IDL_FORM_NAME_EDITOR" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" style="EDIT_FIELD_STYLE_NORMAL" topRelation="IDL_FORM_NAME_EDITOR" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="1280" x="0" y="0"/>
+        <property accessibilityHint="" commandButtonVisible="true" disabledBGBitmapPath="" disabledColor="" disabledColorOpacity="100" disabledTextColor="" ellipsisPosition="ELLIPSIS_POSITION_END" enableClear="true" groupStyle="GROUP_STYLE_NONE" guideText="" guideTextColor="" highlightedBGBitmapPath="" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalMargin="16.0" inputStyle="INPUT_STYLE_OVERLAY" keypadAction="KEYPAD_ACTION_ENTER" keypadEnabled="true" limitLength="255" linkTextColor="" lowerCaseMode="false" normalBGBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="" pressedColor="" pressedColorOpacity="100" text="" textHorizontalAlignment="ALIGNMENT_LEFT" textSize="45.0" titleStyle="EDIT_FIELD_TITLE_STYLE_NONE" titleText="" titleTextColor="" verticalMargin="12.0" viewMode="false"/>
+        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="100.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDL_FORM_NAME_EDITOR" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="IDL_FORM_NAME_EDITOR" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" style="EDIT_FIELD_STYLE_NORMAL" topRelation="IDL_FORM_NAME_EDITOR" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="720.0" x="0.0" y="0.0"/>
+        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="120.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDL_FORM_NAME_EDITOR" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="IDL_FORM_NAME_EDITOR" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" style="EDIT_FIELD_STYLE_NORMAL" topRelation="IDL_FORM_NAME_EDITOR" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="1280.0" x="0.0" y="0.0"/>
     </EditField>
 </Scene>
index 188c389..366b83e 100644 (file)
@@ -29,6 +29,7 @@
 using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Content;
 using namespace Tizen::Graphics;
 using namespace Tizen::Io;
 using namespace Tizen::Media;
@@ -153,9 +154,15 @@ ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        if (pFilePath != null)
        {
                __sourceFilePath.Append(*pFilePath);
-               __imageBuffer.GetImageInfo(pFilePath->GetPointer(), __imageFormat, __imageWidth, __imageHeight);
-               __imageBuffer.Construct(pFilePath->GetPointer());
-               __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO);
+               result r = __imageBuffer.Construct(pFilePath->GetPointer());
+               if (r == E_SUCCESS)
+               {
+                       __imageWidth = __imageBuffer.GetWidth();
+                       __imageHeight = __imageBuffer.GetHeight();
+                       __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO);
+               }
+               Image img;
+               __imageFormat = img.GetImageFormat(__sourceFilePath);
        }
        SetValue();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -228,6 +235,12 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        pCropBuffer->EncodeToFile(destFilePath, __imageFormat, true, 100);
                        delete pCropBuffer;
                }
+               ContentManager contentManager;
+               contentManager.Construct();
+               //contentManager.ScanDirectory(Tizen::System::Environment::GetMediaPath(), true, )
+               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+               pList->Add(new (std::nothrow) String(destFilePath));
+               AppLog("Manish %ls", destFilePath.GetPointer());
                pSceneManager->GoBackward(BackwardSceneTransition());
                AppLog("Exit");
        }
index cadc1a2..631d90b 100644 (file)
@@ -15,7 +15,7 @@
 //
 
 /**
- * @file               GlImageInfo.cpp
+ * @file               IvImageInfo.cpp
  * @brief              This is the implementation file for ImageInfo class.
  */
 
index 89d8005..f1a505d 100644 (file)
@@ -44,11 +44,11 @@ using namespace Tizen::System;
 static const int FILE_MAX_LENGTH = 255;
 
 ImageNameEditorForm::ImageNameEditorForm()
-: __currentIndex(0)
-, __modalMsgBoxResult(0)
-, __pNameEditField(null)
-, __pMessageBox(null)
-, __pPresentationModel(null)
+       : __currentIndex(0)
+       , __modalMsgBoxResult(0)
+       , __pNameEditField(null)
+       , __pMessageBox(null)
+       , __pPresentationModel(null)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -77,18 +77,24 @@ ImageNameEditorForm::OnInitializing(void)
        AddOrientationEventListener(*this);
        Header* pHeader = GetHeader();
        pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CHANGE_NAME"));
+       pHeader->SetStyle(HEADER_STYLE_TITLE);
+       pHeader->SetTitleText(L"Rename");
 
-       pHeader->SetStyle(HEADER_STYLE_BUTTON);
-       HeaderItem doneItem;
-       HeaderItem cancelItem;
-       doneItem.Construct(ACTION_ID_BUTTON_EDITFIELD_DONE);
-       doneItem.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
-       cancelItem.Construct(ACTION_ID_BUTTON_EDITFIELD_CANCEL);
-       cancelItem.SetText(ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
-       pHeader->SetStyle(HEADER_STYLE_BUTTON);
-       pHeader->AddItem(doneItem);
-       pHeader->AddItem(cancelItem);
-       pHeader->AddActionEventListener(*this);
+       SetFormBackEventListener(this);
+
+       GetFooter()->SetBackButtonEnabled(true);
+       GetFooter()->SetBackButton();
+
+       FooterItem itemSave;
+       itemSave.Construct(ACTION_ID_BUTTON_EDITFIELD_SAVE);
+       itemSave.SetText(L"Save");
+
+       GetFooter()->AddItem(itemSave);
+       GetFooter()->AddActionEventListener(*this);
+       GetFooter()->Invalidate(true);
+
+
+       SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
 
        __pNameEditField = static_cast< EditField* >(GetControl(L"IDC_EDITFIELD_NAME"));
 
@@ -148,8 +154,10 @@ ImageNameEditorForm::OnActionPerformed(const Control& source, int actionId)
 
        switch (actionId)
        {
-       case ACTION_ID_BUTTON_EDITFIELD_DONE:
+       case ACTION_ID_BUTTON_EDITFIELD_SAVE:
+
                inputString = __nameEditFieldText;
+
                if (__nameEditFieldPreText == __nameEditFieldText)
                {
                        String msg = ResourceManager::GetString(L"IDS_MEDIABR_POP_SAME_NAME_ALREADY_IN_USE");
@@ -175,7 +183,7 @@ ImageNameEditorForm::OnActionPerformed(const Control& source, int actionId)
                                return;
                        }
                        if (originalFilePath.StartsWith(Environment::GetMediaPath(), 0) == true
-                               || originalFilePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
+                                       || originalFilePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
                        {
                                ImageViewerMediaType mediaType = CommonUtil::GetMediaType(originalFilePath);
                                if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
@@ -198,10 +206,7 @@ ImageNameEditorForm::OnActionPerformed(const Control& source, int actionId)
                        pSceneManager->GoBackward(BackwardSceneTransition());
                }
                break;
-       case ACTION_ID_BUTTON_EDITFIELD_CANCEL:
-               __pNameEditField->SetText(__nameEditFieldPreText);
-               pSceneManager->GoBackward(BackwardSceneTransition());
-               break;
+
        default:
                break;
        }
@@ -209,15 +214,6 @@ ImageNameEditorForm::OnActionPerformed(const Control& source, int actionId)
 }
 
 void
-ImageNameEditorForm::OnFormBackRequested(Form& source)
-{
-       AppLogDebug("ENTER");
-       SceneManager* pSceneManager = SceneManager::GetInstance();
-       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_VIEWER));
-       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
-void
 ImageNameEditorForm::OnTextValueChangeCanceled (const Control &source)
 {
        AppLogDebug("ENTER");
@@ -268,25 +264,23 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source)
 
        inputString.Trim();
 
-       Header* header = GetHeader();
-       HeaderItemStatus itemStatus;
-       header->GetItemStatus(0, itemStatus);
+       FooterItemStatus itemStatus;
+       GetFooter()->GetItemStatus(0, itemStatus);
        if (inputString.GetLength() == 0)
        {
-               if (itemStatus != HEADER_ITEM_STATUS_DISABLED)
+               if (itemStatus != FOOTER_ITEM_STATUS_DISABLED)
                {
-                       header->SetItemEnabled(0, false);
-                       header->RequestRedraw(true);
+                       GetFooter()->SetItemEnabled(0, false);
                }
        }
        else
        {
-               if (itemStatus == HEADER_ITEM_STATUS_DISABLED)
+               if (itemStatus == FOOTER_ITEM_STATUS_DISABLED)
                {
-                       header->SetItemEnabled(0, true);
-                       header->RequestRedraw(true);
+                       GetFooter()->SetItemEnabled(0, true);
                }
        }
+       GetFooter()->Invalidate(true);
 
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -321,28 +315,8 @@ ImageNameEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
                __nameEditFieldTempText = __nameEditFieldText;
                __pNameEditField->ShowKeypad();
 
-               Header* header = GetHeader();
-               HeaderItemStatus itemStatus;
-               header->GetItemStatus(0, itemStatus);
-               filePath.Trim();
-               if (filePath.GetLength() == 0)
-               {
-                       if (itemStatus != HEADER_ITEM_STATUS_DISABLED)
-                       {
-                               header->SetItemEnabled(0, false);
-                               header->RequestRedraw(true);
-                       }
-               }
-               else
-               {
-                       if (itemStatus == HEADER_ITEM_STATUS_DISABLED)
-                       {
-                               header->SetItemEnabled(0, true);
-                               header->RequestRedraw(true);
-                       }
-               }
+               AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
        }
-       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
@@ -384,3 +358,12 @@ ImageNameEditorForm::CreateMessage(String& str)
 
        return;
 }
+
+void
+ImageNameEditorForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       __pNameEditField->SetText(__nameEditFieldPreText);
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+
+}
index a0db32b..dcec557 100644 (file)
@@ -348,6 +348,42 @@ ImageSetterForm::OnActionPerformed(const Control& source, int actionId)
                        delete pContact;
                        delete pAddressbook;
                }
+               else if (status == SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER )
+               {
+                       Image image;
+                       result r = image.Construct();
+                       if (r == E_SUCCESS)
+                       {
+                               String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER;
+                               r = image.EncodeToFile(*__pCurrentBitmap, IMG_FORMAT_JPG, destPath, true);
+                               if (r == E_SUCCESS)
+                               {
+                                       r = SettingInfo::SetValue(SETTING_VALUE_LOCK_SCREEN_WALLPAPER, destPath);
+                               }
+                               else if (r == E_OVERFLOW)
+                               {
+                                       MessageBox messageBox;
+                                       messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000);
+                                       int modalResult = 0;
+                                       messageBox.ShowAndWait(modalResult);
+                               }
+
+                               String destPathHome = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER;
+                               r = image.EncodeToFile(*__pCurrentBitmap, IMG_FORMAT_JPG, destPathHome, true);
+                               if (r == E_SUCCESS)
+                               {
+                                       r = SettingInfo::SetValue(SETTING_VALUE_HOME_SCREEN_WALLPAPER, destPathHome);
+                               }
+                               else if (r == E_OVERFLOW)
+                               {
+                                       MessageBox messageBox;
+                                       messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000);
+                                       int modalResult = 0;
+                                       messageBox.ShowAndWait(modalResult);
+                               }
+
+                       }
+               }
                pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_VIEWER));
                break;
        case ID_BUTTON_CANCEL:
index a1b66ab..a18643a 100644 (file)
@@ -782,6 +782,7 @@ ImageViewerForm::InitializeContextMenuSetAs(void)
                        ACTION_ID_CONTEXTMENU_HOME);
        __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
                        ACTION_ID_CONTEXTMENU_LOCK);
+       __pContextMenuSetAs->AddItem(L"Home and lock screens", ACTION_ID_CONTEXTMENU_HOME_AND_LOCK);
        __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
                        ACTION_ID_CONTEXTMENU_CALLER);
        __pContextMenuSetAs->AddActionEventListener(*this);
@@ -958,8 +959,8 @@ ImageViewerForm::SetDetailInfo(void)
                return r;
        }
 
-               Rectangle rect = GetBounds();
-               __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON - 20, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
+       Rectangle rect = GetBounds();
+       __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON - 20, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
 
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -1351,6 +1352,34 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
                pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
        }
        break;
+       case ACTION_ID_FOOTER_BUTTON_ROTATE_RIGHT:
+       {
+               int currentIndex = __pGallery->GetCurrentItemIndex();
+               String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
+               RotateMode rotateMode = ROTATE_MODE_RIGHT;
+               __pPresentationModel->SetImageRotateStatus(true);
+               RotateImage(filePath, rotateMode);
+               __pPresentationModel->RequestImage(filePath);
+               //Invalidate(true);
+               ContentManager contentManager;
+               contentManager.Construct();
+               contentManager.ScanFile(filePath);
+       }
+       break;
+       case ACTION_ID_FOOTER_BUTTON_ROTATE_LEFT:
+       {
+               int currentIndex = __pGallery->GetCurrentItemIndex();
+               String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
+               RotateMode rotateMode = ROTATE_MODE_LEFT;
+               __pPresentationModel->SetImageRotateStatus(true);
+               RotateImage(filePath, rotateMode);
+               __pPresentationModel->RequestImage(filePath);
+               //Invalidate(true);
+               ContentManager contentManager;
+               contentManager.Construct();
+               contentManager.ScanFile(filePath);
+       }
+       break;
        case ACTION_ID_FOOTER_BUTTON_DETAILS:
        {
                ShowPanelDetail(__detail);
@@ -1405,6 +1434,18 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
                                APPCONTROL_OPERATION_ID_PICK, null, pDataList, this);
                break;
        }
+
+       case ACTION_ID_CONTEXTMENU_HOME_AND_LOCK:
+       {
+               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+               pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
+               pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER));
+               __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
+               break;
+               break;
+       }
+
        case ACTION_ID_CONTEXTMENU_EMAIL:
        {
                OnRequestEmailAction();
@@ -1454,6 +1495,47 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
 }
 
 void
+ImageViewerForm::RotateImage(String& filePath, RotateMode rotateMode)
+{
+       result r = E_SUCCESS;
+       ImageBuffer* pRotatedBuffer = null;
+       ImageBuffer* pRotatedBuffer1 = null;
+       ImageFormat imageFormat;
+       int width = 0;
+       int height = 0;
+       pRotatedBuffer = new (std::nothrow) ImageBuffer();
+       r = pRotatedBuffer->Construct(filePath);
+       pRotatedBuffer->GetImageInfo(filePath, imageFormat, width, height);
+       if (r == E_SUCCESS)
+       {
+               if (rotateMode == ROTATE_MODE_RIGHT)
+               {
+                       pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_90);
+               }
+               else
+               {
+                       pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_270);
+               }
+       }
+       TryCatch(pRotatedBuffer1 != null, r = GetLastResult(), "RotateN failed:%s", GetErrorMessage(GetLastResult()));
+       pRotatedBuffer1->EncodeToFile(filePath, imageFormat, true, 100);
+       delete pRotatedBuffer1;
+       delete pRotatedBuffer;
+       return;
+
+CATCH:
+       if (pRotatedBuffer != null) //this buffer is no longer used
+       {
+               delete pRotatedBuffer;
+       }
+       if (pRotatedBuffer1 != null) //this buffer is no longer used
+       {
+               delete pRotatedBuffer1;
+       }
+       return;
+}
+
+void
 ImageViewerForm::OnFormBackRequested(Form& source)
 {
        AppLogDebug("ENTER");
index f9a7ac3..37ed86f 100644 (file)
@@ -66,6 +66,7 @@ ImageViewerPresentationModel::ImageViewerPresentationModel(void)
        , __transitionEffectOfSlideShow(SLIDE_SHOW_TRANSITION_EFFECT_SLIDE)
        , __pFileEventManager(null)
        , __pSettingPresentationModel(null)
+       , __isImageRotated(false)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -561,6 +562,16 @@ int ImageViewerPresentationModel::GetImageCacheIndex(const String &path)
        return -1;
 }
 
+void ImageViewerPresentationModel::SetImageRotateStatus(bool value)
+{
+       __isImageRotated = true;
+}
+
+bool ImageViewerPresentationModel::GetImageRotateStatus(void) const
+{
+       return __isImageRotated;
+}
+
 void ImageViewerPresentationModel::OnFileEventOccured (const unsigned long events, const String &path, const unsigned int eventId)
 {
        AppLogDebug("Enter");
@@ -570,7 +581,7 @@ void ImageViewerPresentationModel::OnFileEventOccured (const unsigned long event
        AppLogDebug("event delete is %d", eventDelete);
        //AppLogDebug(" event move is %d", eventMoveSelf);
        int index = GetImageCacheIndex(path);
-       if (index != -1 && eventDelete)
+       if (index != -1 && eventDelete && GetImageRotateStatus() == false)
        {
                AppLogDebug("event index is %d, removing the index", index);
                __pImageCaches->RemoveAt(index, true);