Change delete string
[apps/osp/ImageViewer.git] / src / IvImageViewerForm.cpp
index a1b66ab..3dcd141 100644 (file)
@@ -27,6 +27,7 @@
 #include "IvImageViewerPresentationModel.h"
 #include "IvResourceManager.h"
 #include "IvSettingPresentationModel.h"
+#include "IvSlideShowPopUp.h"
 #include "IvTypes.h"
 
 using namespace Tizen::App;
@@ -43,11 +44,13 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
-static const unsigned int COLOR_HEADER_CONTORL_PANEL = Color32<0, 0, 0, 100>::Value;
+static const unsigned int COLOR_HEADER_CONTROL_LABEL = Color32<0, 0, 0, 0>::Value;
+static const unsigned int COLOR_HEADER_CONTROL_PANEL = Color32<0, 0, 0, 100>::Value;
 static const unsigned int COLOR_HEADER_BUTTON1 = Color32<0, 0, 0, 100>::Value;
 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
+static const unsigned int COLOR_GALLERY_BG = Color32<31,31,31>::Value;
 
 static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
 
@@ -92,27 +95,31 @@ static const int DETAIL_MAIN_FONT_SIZE = 36;
 static const int DETAIL_COUNT_MAX = 9;
 
 ImageViewerForm::ImageViewerForm(void)
-: __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
-, __pHeader(null)
-, __pFooter(null)
-, __pScrollPanel(null)
-, __pDetail_Label(null)
-, __pLabelMessage(null)
-, __pPlayButton(null)
-, __pRenameButton(null)
-, __pDetailFooterItem(null)
-, __pGallery(null)
-, __pTimer(null)
-, __pContextMenuMore(null)
-, __pContextMenuCopy(null)
-, __pContextMenuSetAs(null)
-, __pContextMenuShare(null)
-, __pDeletePopup(null)
-, __visible(true)
-, __detail(true)
-, __startSlide(false)
-, __requestId(0)
-, __pPresentationModel(null)
+       : __shuffelStartIndex(0)
+       , __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
+       , __pLabel(null)
+       , __pFooter(null)
+       , __pScrollPanel(null)
+       , __pDetail_Label(null)
+       , __pLabelMessage(null)
+       , __pPlayButton(null)
+       , __pRenameButton(null)
+       , __pDetailFooterItem(null)
+       , __pGallery(null)
+       , __pTimer(null)
+       , __pShuffelTimer(null)
+       , __pContextMenuMore(null)
+       , __pContextMenuCopy(null)
+       , __pContextMenuSetAs(null)
+       , __pContextMenuShare(null)
+       , __pDeletePopup(null)
+       , __visible(true)
+       , __detail(true)
+       , __startSlide(false)
+       , __shuffle(false)
+       , __requestId(0)
+       , __pShuffledList(null)
+       , __pPresentationModel(null)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -128,6 +135,9 @@ result
 ImageViewerForm::Initialize()
 {
        AppLogDebug("ENTER");
+
+       result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
+
        __pPresentationModel = ImageViewerPresentationModel::GetInstance();
 
        if (__pPresentationModel->GetFileCount() > 0)
@@ -162,8 +172,6 @@ ImageViewerForm::Initialize()
                __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
        }
 
-       result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
-
        if (filePath == EMPTY_SPACE)
        {
                MessageBox messageBox;
@@ -185,17 +193,45 @@ result
 ImageViewerForm::OnInitializing(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        SetFormBackEventListener(this);
        __pPresentationModel->AddListener(this);
 
+       __pLabel = dynamic_cast<Label*>(GetControl(L"IDC_LABEL_INFO"));
+
+       if(__pLabel == null)
+       {
+               return E_FAILURE;
+       }
+       __pLabel->SetBackgroundColor(COLOR_HEADER_CONTROL_LABEL);
+       SetControlAlwaysOnTop(*__pLabel,true);
+       int allCount = __pPresentationModel->GetFileCount();
+       int index = 1 ;
+       String displayText;
+       displayText.Append(index);
+       displayText.Append("/");
+       displayText.Append(allCount);
+
+       __pLabel->SetText(displayText);
+
        CreateGallery();
        InitializeDisplay(__initializeDisplayModeCurrent);
        InitializePanelDetail();
        InitializePopup();
 
+       __pPopUp = new (std::nothrow) SlideShowPopUp();
+
+       if (__pPopUp != null)
+       {
+               __pPopUp->Initialize();
+               __pPopUp->SetEventListner(this);
+               AddControl(*__pPopUp);
+       }
+
+
        if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
-               || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
-               || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
+                       || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
+                       || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
        {
                int index = __pPresentationModel->GetStartIndex();
                __pGallery->UpdateGallery();
@@ -216,7 +252,7 @@ ImageViewerForm::OnInitializing(void)
                __pTimer->Construct(*this);
                __pTimer->Start(1);
        }
-       result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
+
        AddOrientationEventListener(*this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -248,7 +284,7 @@ ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus o
        Rectangle clientRect = GetClientAreaBounds();
        Rectangle rect = GetBounds();
 
-       __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
+       __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height));
        __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
                        clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
 
@@ -260,20 +296,16 @@ void
 ImageViewerForm::InitializeDisplay(AppControlMode status)
 {
        AppLogDebug("ENTER");
-       String strItemText;
-       String strItemIdxText;
 
-       __pHeader = GetHeader();
-       __pHeader->AddActionEventListener(*this);
+       String strItemIdxText;
 
        __pFooter = GetFooter();
        __pFooter->AddActionEventListener(*this);
        __pFooter->RemoveAllItems();
 
-       GetHeaderString(0, strItemText, strItemIdxText);
+       GetLabelText(0, strItemIdxText);
        Rectangle rect = GetClientAreaBounds();
-       __pHeader->SetTitleText(strItemText);
-       __pHeader->SetDescriptionText(strItemIdxText);
+
 
        if (status == APPCONTROL_MODE_NORMAL)
        {
@@ -418,12 +450,11 @@ ImageViewerForm::InitializeDisplay(AppControlMode status)
 }
 
 void
-ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
+ImageViewerForm::GetLabelText(int index, String &page)
 {
        AppLogDebug("ENTER");
        int allCount = __pPresentationModel->GetFileCount();
        String pStr = __pPresentationModel->GetFilePathAt(index);
-       fileName = __pPresentationModel->GetFileName(pStr);
        page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -462,7 +493,7 @@ ImageViewerForm::DeleteImageFile()
        }
 
        if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
-               || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
+                       || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
        {
                ContentManager::ScanFile(filePath);
        }
@@ -485,9 +516,9 @@ ImageViewerForm::DeleteImageFile()
        filePath = __pPresentationModel->GetFilePathAt(currentIndex);
        __pPresentationModel->RequestImage(filePath);
 
-       GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
-       __pHeader->SetTitleText(strItemText);
-       __pHeader->SetDescriptionText(strItemIdxText);
+       GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText);
+
+       __pLabel->SetText(strItemIdxText);
 
        if (__visible == true)
        {
@@ -516,10 +547,8 @@ ImageViewerForm::CallVideoPlayer(void)
        String filePath = __pPresentationModel->GetFilePathAt(index);
        filePath.Insert(APPCONTROL_DATA_URI_FILE, 0);
 
-       AppLogDebug("ENTER(%ls)", filePath.GetPointer());
-
        __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER, APPCONTROL_OPERATION_ID_VIEW,
-                       &filePath, null, this);
+                       new (std::nothrow) String(filePath), new (std::nothrow) String(APPCONTROL_MIME_VIDEO_ALL), null, this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -531,10 +560,11 @@ ImageViewerForm::CreateGallery(void)
        Rectangle rect = GetBounds();
 
        __pGallery = new (std::nothrow) Gallery();
-       __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
+       __pGallery->Construct(Rectangle(0, clientRect.y, rect.width, rect.height));
        __pGallery->SetName(L"GalleryControl");
        __pGallery->SetItemProvider(*this);
        __pGallery->AddGalleryEventListener(*this);
+       __pGallery->SetBackgroundColor(COLOR_GALLERY_BG);
        AddControl(*__pGallery);
        __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
 
@@ -548,7 +578,8 @@ ImageViewerForm::CreateGallery(void)
        case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
                __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
                break;
-       case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
+       case SLIDE_SHOW_TRANSITION_EFFECT_PAGE:
+               __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_PAGE);
                break;
        }
 
@@ -565,9 +596,9 @@ ImageViewerForm::InitializePanelDetail()
 
        String arrayId[DETAIL_COUNT_MAX] =
        {
-                       L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
-                       L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
-                       L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
+               L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
+               L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
+               L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
        };
 
        if (__pScrollPanel == null)
@@ -578,7 +609,7 @@ ImageViewerForm::InitializePanelDetail()
        }
 
        Rectangle clientRect = GetClientAreaBounds();
-       result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height));
+       result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height - __pLabel->GetHeight()));
        if (r != E_SUCCESS)
        {
                AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
@@ -633,7 +664,7 @@ ImageViewerForm::InitializePanelDetail()
                __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
        }
 
-       __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
+       __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTROL_PANEL);
        __pScrollPanel->SetShowState(false);
 
        __pRenameButton = new (std::nothrow) Button();
@@ -688,7 +719,7 @@ ImageViewerForm::InitializePopup(void)
 
                Label* pLabel = new (std::nothrow) Label();
                pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
-                               ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
+                               ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
 
                Button* pDeleteButton = new (std::nothrow) Button();
                pDeleteButton->Construct(
@@ -739,7 +770,7 @@ ImageViewerForm::InitializeContextMenuMore(void)
 
        __pContextMenuMore = new (std::nothrow) ContextMenu();
 
-       __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
+       __pContextMenuMore->Construct(Point(X_MORE,  GetClientAreaBounds().height),
                        CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
 
        if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
@@ -782,6 +813,8 @@ 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(ResourceManager::GetString(L"IDS_IV_BODY_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);
@@ -839,8 +872,7 @@ ImageViewerForm::SetDetailInfo(void)
        AppLogDebug("ENTER");
 
        Rectangle clientRect = GetClientAreaBounds();
-       __pScrollPanel->SetBounds(0, 0, clientRect.width, clientRect.height);
-
+       __pScrollPanel->SetBounds(0,__pLabel->GetHeight(), clientRect.width, clientRect.height - __pLabel->GetHeight());
        int currentIndex = __pGallery->GetCurrentItemIndex();
        String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
 
@@ -894,6 +926,11 @@ ImageViewerForm::SetDetailInfo(void)
        String fileName = File::GetFileName(strFilePath);
        strResult[8].Remove(strResult[8].GetLength() - fileName.GetLength(), fileName.GetLength());
 
+       if (strResult[8].StartsWith(Tizen::System::Environment::GetMediaPath(), 0) == true)
+       {
+               strResult[8].Replace(Tizen::System::Environment::GetMediaPath(), MEDIA_ROOT_PHONE, 0);
+       }
+
        if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
        {
                strResult[0] = __downLordFileName;
@@ -949,7 +986,23 @@ ImageViewerForm::SetDetailInfo(void)
        for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
        {
                __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
-               __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
+
+               if (i == DETAIL_COUNT_MAX - 1)
+               {
+                       __pDetail_FileInfo_Value_Label[i]->SetBounds(
+                                       Rectangle(X_DETAIL_FILEINFO_LABEL,
+                                                       GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
+                                                       clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL * 3));
+               }
+               else
+               {
+                       __pDetail_FileInfo_Value_Label[i]->SetBounds(
+                                       Rectangle(X_DETAIL_FILEINFO_LABEL,
+                                                       GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
+                                                       clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL));
+               }
+
+               __pDetail_FileInfo_Value_Label[i]->Invalidate(true);
        }
 
        if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
@@ -958,8 +1011,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()));
 
@@ -973,11 +1026,15 @@ ImageViewerForm::ShowPanelDetail(bool showStatus)
        if (showStatus)
        {
                SetDetailInfo();
+               __pLabel->SetBackgroundColor(COLOR_HEADER_CONTROL_PANEL);
+               __pLabel->Invalidate(true);
                __pScrollPanel->SetShowState(true);
                __detail = false;
        }
        else
        {
+               __pLabel->SetBackgroundColor(COLOR_HEADER_CONTROL_LABEL);
+               __pLabel->Invalidate(true);
                __pScrollPanel->SetShowState(false);
                __detail = true;
        }
@@ -1058,9 +1115,17 @@ ImageViewerForm::CreateItem(int index)
        AppLogDebug("ENTER : index(%d)", index);
        GalleryItem* pGallery = new (std::nothrow) GalleryItem();
 
-       String filePath = __pPresentationModel->GetFilePathAt(index);
-       ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
+       int curIndex = index;
+
+       if (__shuffle == true && __pShuffledList != null)
+       {
+               curIndex = __pShuffledList[index];
+       }
+
+       String filePath = __pPresentationModel->GetFilePathAt(curIndex);
+       ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(curIndex);
        Bitmap* pBitmap = pImageInfo->GetBitmapN();
+
        if (pBitmap == null)
        {
                pBitmap = GetQuickThumbnailN(filePath);
@@ -1081,8 +1146,16 @@ ImageViewerForm::CreateItem(int index)
 bool
 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
 {
-       AppLogDebug("ENTER index(%d)", index);
-       ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
+       AppLogDebug("ImageViewerForm::DeleteItem ENTER index(%d)", index);
+       int curIndex = index;
+
+       if(__shuffle == true && __pShuffledList != null)
+       {
+               curIndex = __pShuffledList[index];
+       }
+
+
+       ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(curIndex);
        pImageInfo->ClearBitmap();
        delete pItem;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1093,17 +1166,15 @@ ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
 void
 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
 {
-       AppLogDebug("ENTER index(%d)", index);
+       AppLogDebug("ImageViewerForm::OnGalleryCurrentItemChanged index(%d)", index);
 
        String filePath = __pPresentationModel->GetFilePathAt(index);
        AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
        __pPresentationModel->RequestImage(filePath);
 
-       String strItemText;
        String strItemIdxText;
-       GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
-       __pHeader->SetTitleText(strItemText);
-       __pHeader->SetDescriptionText(strItemIdxText);
+       GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText);
+       __pLabel->SetText(strItemIdxText);
 
        if (__visible == true)
        {
@@ -1137,7 +1208,8 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
                        __pPlayButton->SetShowState(false);
                }
 
-               SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
+               SetActionBarsVisible( FORM_ACTION_BAR_FOOTER, false);
+               __pLabel->SetShowState(false);
                __visible = false;
        }
        else
@@ -1147,7 +1219,8 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
                        __pPlayButton->SetShowState(true);
                }
 
-               SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
+               SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
+               __pLabel->SetShowState(true);
                __visible = true;
 
                __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
@@ -1156,7 +1229,7 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
 
        Rectangle clientRect = GetClientAreaBounds();
        Rectangle rect = GetBounds();
-       __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
+       __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height));
        Invalidate(true);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -1168,7 +1241,8 @@ ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
        PowerManager::KeepScreenOnState(true, false);
        if (__visible  == true)
        {
-               SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
+               SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
+               __pLabel->SetShowState(false);
 
                int index = __pGallery->GetCurrentItemIndex();
                String filePath = __pPresentationModel->GetFilePathAt(index);
@@ -1192,14 +1266,40 @@ ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
 void
 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
 {
-       AppLogDebug("ENTER");
+       AppLogDebug("ImageViewerForm::OnGallerySlideShowStopped");
+
+       int index;
+
+       if(__shuffle == true)
+       {
+
+               if(__pShuffelTimer == null)
+               {
+                       __pShuffelTimer = new (std::nothrow) Timer();
+                       __pShuffelTimer->Construct(*this);
+               }
+               __pShuffelTimer->Start(1);
+       }
+       else
+       {
+               index = __pGallery->GetCurrentItemIndex();
+               SlideShowStopped(index);
+       }
+
+
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
+ImageViewerForm::SlideShowStopped(int index)
+{
+       AppLog("ImageViewerForm::SlideShowStopped");
        PowerManager::KeepScreenOnState(false, true);
-       int index = __pGallery->GetCurrentItemIndex();
 
        if (__visible == false)
        {
-               SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
-
+               SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
+               __pLabel->SetShowState(true);
                String filePath = __pPresentationModel->GetFilePathAt(index);
                ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
                if (contentType == CONTENT_TYPE_VIDEO)
@@ -1213,18 +1313,16 @@ ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
                __visible = true;
        }
 
-       String strItemText;
        String strItemIdxText;
-       GetHeaderString(index, strItemText, strItemIdxText);
-       __pHeader->SetTitleText(strItemText);
-       __pHeader->SetDescriptionText(strItemIdxText);
+       GetLabelText(index, strItemIdxText);
+       __pLabel->SetText(strItemIdxText);
+
 
        Rectangle clientRect = GetClientAreaBounds();
        Rectangle rect = GetBounds();
        __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
 
        Invalidate(true);
-       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
@@ -1244,6 +1342,13 @@ ImageViewerForm::OnTerminating(void)
                __pTimer = null;
        }
 
+       if(__pShuffelTimer)
+       {
+               __pShuffelTimer->Cancel();
+               delete __pShuffelTimer;
+               __pShuffelTimer = null;
+       }
+
        __pPresentationModel->ClearImageRequests();
        __pPresentationModel->RemoveListener(*this);
        __pPresentationModel->RemoveFileUpdateListener(*this);
@@ -1278,6 +1383,12 @@ ImageViewerForm::OnTerminating(void)
                __pContextMenuMore = null;
        }
 
+       if(__pShuffledList != null)
+       {
+               free(__pShuffledList);
+               __pShuffledList = null;
+       }
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return E_SUCCESS;
@@ -1318,39 +1429,62 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
                break;
        case ACTION_ID_FOOTER_BUTTON_SLIDE:
        {
-               int repeatValue = 0;
-
-               if (__pPresentationModel->GetFileCount() > 1)
+               if (__pPopUp != null)
                {
-                       __pGallery->UpdateGallery();
-                       if (__detail == false)
-                       {
-                               ShowPanelDetail(false);
-                       }
-
-                       __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
-                                       ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
-
-                       if (repeatValue == 0)
-                       {
-                               __pGallery->StartSlideShow(false);
-                       }
-                       else
-                       {
-                               __pGallery->StartSlideShow(true);
-                       }
+                       __pPopUp->SetShowState(true);
+                       __pPopUp->Show();
                }
+
                break;
        }
        case ACTION_ID_FOOTER_BUTTON_CROP:
        {
                String filePath;
-               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
                filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
+               ImageBuffer imagebuffer;
+               result r = imagebuffer.Construct(filePath);
+               if (r != E_SUCCESS)
+               {
+                       return;
+               }
+               int imageWidth = imagebuffer.GetWidth();
+               int imageHeight = imagebuffer.GetHeight();
+               if (imageWidth <= (CROP_RECTANGLE_HEIGHT * 3) || imageHeight <= (CROP_RECTANGLE_HEIGHT * 3))
+               {
+                       MessageBox messageBox;
+                       String messageText = ResourceManager::GetString(L"IDS_IMGE_POP_IMAGE_IS_TOO_SMALL");
+                       messageBox.Construct(L"", messageText, MSGBOX_STYLE_OK, 3000);
+                       int modalResult = 0;
+                   messageBox.ShowAndWait(modalResult);
+                   return;
+               }
+               String cropMode = L"auto";
+               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
                pList->Add(new (std::nothrow) String(filePath));
+               pList->Add(new (std::nothrow) String(cropMode));
                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;
+               RotateImage(filePath, rotateMode);
+               __pPresentationModel->RequestImage(filePath);
+               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;
+               RotateImage(filePath, rotateMode);
+               __pPresentationModel->RequestImage(filePath);
+               ContentManager::ScanFile(filePath);
+       }
+       break;
        case ACTION_ID_FOOTER_BUTTON_DETAILS:
        {
                ShowPanelDetail(__detail);
@@ -1374,20 +1508,24 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
        }
        case ACTION_ID_CONTEXTMENU_HOME:
        {
+               String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
+               String cropMode = "fit-to-screen";
                ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
-               pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
+               pList->Add(new (std::nothrow) String(filePath));
+               pList->Add(new (std::nothrow) String(cropMode));
                pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
-               __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
                break;
        }
        case ACTION_ID_CONTEXTMENU_LOCK:
        {
+               String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
+               String cropMode = "fit-to-screen";
                ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
-               pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
+               pList->Add(new (std::nothrow) String(filePath));
+               pList->Add(new (std::nothrow) String(cropMode));
                pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
-               __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
                break;
        }
        case ACTION_ID_CONTEXTMENU_CALLER:
@@ -1402,9 +1540,22 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
                                new (std::nothrow) String(APPCONTROL_DATA_ITEM_ID));
 
                __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
-                               APPCONTROL_OPERATION_ID_PICK, null, pDataList, this);
+                               APPCONTROL_OPERATION_ID_SOCIAL_PICK, null, null, pDataList, this);
+               break;
+       }
+
+       case ACTION_ID_CONTEXTMENU_HOME_AND_LOCK:
+       {
+               String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
+               String cropMode = "fit-to-screen";
+               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+               pList->Add(new (std::nothrow) String(filePath));
+               pList->Add(new (std::nothrow) String(cropMode));
+               pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER));
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
                break;
        }
+
        case ACTION_ID_CONTEXTMENU_EMAIL:
        {
                OnRequestEmailAction();
@@ -1454,6 +1605,42 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
 }
 
 void
+ImageViewerForm::RotateImage(String& filePath, RotateMode rotateMode)
+{
+       result r = E_SUCCESS;
+       ImageBuffer rotateBuffer;
+       ImageBuffer* pRotatedBuffer = null;
+       ImageFormat imageFormat;
+       Image img;
+       r = img.Construct();
+
+       if (r == E_SUCCESS)
+       {
+               imageFormat = img.GetImageFormat(filePath);
+       }
+
+       r = rotateBuffer.Construct(filePath);
+       if (r == E_SUCCESS)
+       {
+               if (rotateMode == ROTATE_MODE_RIGHT)
+               {
+                       pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
+               }
+               else
+               {
+                       pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
+               }
+       }
+
+       if (pRotatedBuffer != null)
+       {
+               r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
+               delete pRotatedBuffer;
+       }
+       return;
+}
+
+void
 ImageViewerForm::OnFormBackRequested(Form& source)
 {
        AppLogDebug("ENTER");
@@ -1478,21 +1665,31 @@ ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
        Rectangle clientRect = GetClientAreaBounds();
        Rectangle rect = GetBounds();
 
-       __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
-       __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, clientRect.height));
+       __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height));
+       __pScrollPanel->SetBounds(Rectangle(0, __pLabel->GetHeight(), clientRect.width, clientRect.height -  __pLabel->GetHeight()));
        __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - 80, clientRect.height / 2 - 80, 160, 160));
 
        if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
        {
                SetDetailInfo();
-               String strItemText(EMPTY_SPACE);
                String strItemIdxText(EMPTY_SPACE);
-               GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
-               __pHeader->SetTitleText(strItemText);
-               __pHeader->SetDescriptionText(strItemIdxText);
+               GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText);
+               __pLabel->SetText(strItemIdxText);
                Invalidate(true);
        }
 
+       if (previousSceneId == IDSCN_IMAGE_CROP && pArgs != null)
+       {
+               String filePath;
+               filePath = *(static_cast<String*>(pArgs->GetAt(0)));
+               delete pArgs;
+               int count = __pPresentationModel->GetFileCount();
+               __pPresentationModel->AddImageCache(filePath);
+               __pGallery->UpdateGallery();
+               __pGallery->SetCurrentItemIndex(count);
+               __pPresentationModel->RequestImage(filePath);
+       }
+
        if (__pGallery->GetCurrentItemIndex() < 0)
        {
                SetFooterItemState(false);
@@ -1530,23 +1727,32 @@ ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
        AppLogDebug("ENTER");
 
        if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
-                       && operationId == APPCONTROL_OPERATION_ID_PICK
+                       && operationId == APPCONTROL_OPERATION_ID_SOCIAL_PICK
                        && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
        {
-               const String* pContactId =
-                               static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_SOCIAL_ITEM_ID)));
-               SceneManager* pSceneManager = SceneManager::GetInstance();
+               const ArrayList* pResultList =
+                               static_cast<const ArrayList*>(pExtraData->GetValue(String(APPCONTROL_KEY_SOCIAL_ITEM_ID)));
+               const String* pContactId = null;
+
+               if (pResultList != null)
+               {
+                       pContactId = static_cast<const String*>(pResultList->GetAt(0));
+               }
+
                long long lresult = 0;
                if (pContactId != null && pContactId->GetLength() > 0)
                {
                        LongLong::Parse(*pContactId, lresult);
+                       String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
+                       String cropMode = "fit-to-screen";
+                       ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+                       pList->Add(new (std::nothrow) String(filePath));
+                       pList->Add(new (std::nothrow) String(cropMode));
+                       pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
+                       pList->Add(new (std::nothrow) LongLong(lresult));
+                       SceneManager* pSceneManager = SceneManager::GetInstance();
+                       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
                }
-               ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
-               pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
-               pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
-               pList->Add(new (std::nothrow) LongLong(lresult));
-               __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
        }
 
        ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
@@ -1606,14 +1812,51 @@ ImageViewerForm::InitShowGallery(void)
 void
 ImageViewerForm::OnTimerExpired(Timer &timer)
 {
-       int repeatValue = 0;
-       AppLogDebug("ENTER");
+       AppLog("ImageViewerForm::OnTimerExpired");
+
+       if(timer.Equals(*__pShuffelTimer) == true)
+       {
+               AppLog("OnTimerExpired __pShuffelTimer");
+               int curItemIndex = __pGallery->GetCurrentItemIndex();
+               int index = __pShuffledList[curItemIndex];
+
+               __shuffle = false;
+
+               __pGallery->UpdateGallery();
+
+               AppLog("ImageViewerForm::OnGallerySlideShowStopped index = %d, shuffelIndex = %d", curItemIndex, index);
+
+               __pGallery->SetCurrentItemIndex(index);
+               __pGallery->Draw();
+
+               SlideShowStopped(index);
+               return;
+       }
+
+       int repeatValue  = 0;
+       int shuffleValue = 0;
+
        if (__pPresentationModel->GetFileCount() > 1)
        {
                __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
-                               ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
+                                                       ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
+
+                __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
+                                                       ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffleValue);
+
+               if (shuffleValue != 0)
+               {
+                       __shuffelStartIndex = __pGallery->GetCurrentItemIndex();
+                       CreateShuffledList(__pPresentationModel->GetFileCount());
+                       __shuffle = true;
+               }
+               else
+               {
+                       __shuffelStartIndex = 0;
+                       __shuffle = false;
+               }
 
-               if (repeatValue == 0)
+               if ( repeatValue == 0)
                {
                        __pGallery->StartSlideShow(false);
                }
@@ -1626,6 +1869,34 @@ ImageViewerForm::OnTimerExpired(Timer &timer)
 }
 
 void
+ImageViewerForm::CreateShuffledList(int count)
+{
+       AppLogDebug("ImageViewerForm::CreateShuffledList ENTER");
+       if(__pShuffledList == null)
+       {
+               __pShuffledList = new (std::nothrow) int[count];
+               for(int i = 0; i < count; i++)
+               {
+                       __pShuffledList[i] = i;
+               }
+       }
+       for(int i = count - 1; i > 1; i--)
+       {
+               int randomNum = Math::Rand() % (i+1);
+               int t = __pShuffledList[randomNum];
+               __pShuffledList[randomNum] = __pShuffledList[i];
+               __pShuffledList[i] = t;
+       }
+
+       for(int i = 0; i < count; i++)
+       {
+               AppLogDebug("ShuffeldList i = %d & Val = %d", i, __pShuffledList[i]);
+       }
+
+       AppLogDebug("ImageViewerForm::CreateShuffledList EXIT");
+}
+
+void
 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
 {
        AppLogDebug("ENTER");
@@ -1741,13 +2012,13 @@ ImageViewerForm::OnRequestEmailAction(void)
        HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
        pDataList->Construct();
 
-       IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        pList->Add(new (std::nothrow) String(filePath));
 
-       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pList);
+       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pList);
 
        __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
-                       null, pDataList, this);
+                       new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -1767,16 +2038,13 @@ ImageViewerForm::OnRequestMessagesAction(void)
 
        HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
        pDataList->Construct();
-       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE),
-                       new (std::nothrow) String(APPCONTROL_DATA_MMS));
-
-       IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        pList->Add(new (std::nothrow) String(filePath));
+       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pList);
+       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
 
-       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pList);
-
-       __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES,
-                       APPCONTROL_OPERATION_ID_COMPOSE, null, pDataList, this);
+       __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES, APPCONTROL_OPERATION_ID_COMPOSE, null,
+                       null, pDataList, this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -1877,7 +2145,7 @@ ImageViewerForm::GetQuickThumbnailN(String& filePath)
                                if (r == E_SUCCESS)
                                {
                                        if (imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_RIGHT_TOP
-                                               || imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_LEFT_BOTTOM)
+                                                       || imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_LEFT_BOTTOM)
                                        {
                                                Dimension srcDim(imageBuffer->GetHeight(), imageBuffer->GetWidth());
                                                pBitmap->Scale(srcDim);
@@ -1907,7 +2175,7 @@ ImageViewerForm::GetQuickThumbnailN(String& filePath)
                {
                        Canvas mainCanvas;
                        mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
-                       mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
+                       mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), DUMMY_IMAGE_RECTANGLE);
                        pBitmap = new (std::nothrow) Bitmap();
                        pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
                }
@@ -1919,42 +2187,35 @@ ImageViewerForm::GetQuickThumbnailN(String& filePath)
 void ImageViewerForm::OnFormFileEventOccuered(const int index, const unsigned long eventId)
 {
        AppLogDebug(" ENTER");
-       bool eventDelete = (eventId & FILE_EVENT_TYPE_DELETE_SELF);
-       bool eventMove = (eventId & 0x8000);// (eventId & FILE_EVENT_TYPE_MOVE_SELF);
 
        int currentIndex = __pGallery->GetCurrentItemIndex();
-       int countPath = __pPresentationModel->GetFileCount();
+       int fileCount = __pPresentationModel->GetFileCount();
 
-       if (countPath == 0 && eventDelete)
+       if (fileCount == 0 && eventId == IV_FILE_DELETE)
        {
                UiApp* pApp = UiApp::GetInstance();
                pApp->Terminate();
                AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
        }
-       AppLogDebug(" countPath is %d", countPath);
-       AppLogDebug(" currentIndex is %d", currentIndex);
 
-       if (countPath == currentIndex && eventDelete)
+       if (fileCount <= currentIndex && eventId == IV_FILE_DELETE)
        {
-               __pGallery->SetCurrentItemIndex(--currentIndex);
+               currentIndex = fileCount - 1;
        }
-       else if (eventMove)
+       else if (eventId == IV_FILE_CREATE)
        {
                currentIndex = index;
-               __pGallery->SetCurrentItemIndex(currentIndex);
        }
 
-       String strItemText(EMPTY_SPACE);
-       String strItemIdxText(EMPTY_SPACE);
 
+       String strItemIdxText(EMPTY_SPACE);
+       __pGallery->SetCurrentItemIndex(currentIndex);
        __pGallery->UpdateGallery();
-       AppLogDebug(" UpdateGallery is %d", currentIndex);
        String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
        __pPresentationModel->RequestImage(filePath);
 
-       GetHeaderString(currentIndex, strItemText, strItemIdxText);
-       __pHeader->SetTitleText(strItemText);
-       __pHeader->SetDescriptionText(strItemIdxText);
+       GetLabelText(currentIndex,strItemIdxText);
+       __pLabel->SetText(strItemIdxText);
 
        if (__visible == true)
        {
@@ -1978,3 +2239,86 @@ void ImageViewerForm::OnFormFileEventOccuered(const int index, const unsigned lo
        Invalidate(true);
        AppLogDebug("EXIT");
 }
+
+void
+ImageViewerForm::OnSlideSettingPopUpItemSelected(int index)
+{
+       if ( __pPopUp != NULL)
+       {
+               __pPopUp->SetShowState(false);
+       }
+
+       if (index == 0)   // start slide show
+       {
+       int repeatValue = 0;
+               int interval = 0 ;
+               int transitioneffect = 0;
+
+               if (__pPresentationModel->GetFileCount() > 1)
+               {
+                       int shuffleValue;
+                       __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
+                                                                       ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, interval);
+
+                               interval = interval * 1000;
+                       AppLogDebug("The slide interval is %d", interval);
+                               __pGallery->SetSlideShowViewDuration(interval);
+
+
+                       __pGallery->UpdateGallery();
+
+                       if (__detail == false)
+                       {
+                               ShowPanelDetail(false);
+                       }
+
+                       __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
+                                       ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
+
+                       __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
+                                       ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffleValue);
+
+                        __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
+                                   ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, transitioneffect);
+
+                        if (transitioneffect == 1)
+                        {
+                                __pGallery->SetSlideShowAnimation(GALLERY_ANIMATION_DISSOLVE);
+                        }
+                        else if (transitioneffect == 2)
+                        {
+                                __pGallery->SetSlideShowAnimation(GALLERY_ANIMATION_ZOOM);
+                        }
+                        else
+                        {
+                                __pGallery->SetSlideShowAnimation(GALLERY_ANIMATION_PAGE);
+                        }
+
+                       if (shuffleValue != 0)
+                       {
+                               __shuffelStartIndex = __pGallery->GetCurrentItemIndex();
+                               CreateShuffledList(__pPresentationModel->GetFileCount());
+                               __shuffle = true;
+                       }
+                       else
+                       {
+                               __shuffelStartIndex = 0;
+                               __shuffle = false;
+                       }
+
+                       if (repeatValue == 0)
+                       {
+                               __pGallery->StartSlideShow(false);
+                       }
+                       else
+                       {
+                               __pGallery->StartSlideShow(true);
+                       }
+               }
+       }
+       else if (index == 1) // launch settings
+       {
+               __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_GALLERY,
+                               APPCONTROL_OPERATION_ID_CONFIGURE, null, null, null, this);
+       }
+}