Fixed issue 46213 and popup changes
[apps/osp/Gallery.git] / src / GlAlbumListEditorForm.cpp
index 25c0950..14fa78a 100644 (file)
@@ -57,7 +57,7 @@ static const int FORMAT_BUFFER_SIZE = 256;
 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
 
-static const int IDA_ALBUM_EDIT = 503 ;
+static const int IDA_ALBUM_EDIT = 503;
 
 AlbumListEditorForm::AlbumListEditorForm(void)
        : __checkedCount(0)
@@ -144,9 +144,9 @@ AlbumListEditorForm::OnContentUpdated(void)
 {
        AppLogDebug("ENTER");
        int maxCount = __pPresentationModel->GetFolderCount();
-       if(__pDeletePopup != null)
+       if (__pDeletePopup != null)
        {
-               if(__pDeletePopup->IsVisible() == true)
+               if (__pDeletePopup->IsVisible() == true)
                {
                        __pDeletePopup->Destroy();
                        __pDeletePopup = null;
@@ -202,8 +202,7 @@ AlbumListEditorForm::InitializePopup(void)
                pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
 
                Button* pDeleteButton = new (std::nothrow) Button();
-               pDeleteButton->Construct(
-                               Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
+               pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,     popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
                                ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
                pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
                pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
@@ -212,10 +211,8 @@ AlbumListEditorForm::InitializePopup(void)
                pDeleteButton->AddActionEventListener(*this);
 
                Button* pCancelButton = new (std::nothrow) Button();
-               pCancelButton->Construct(
-                               Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
-                                               popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
-                                               ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
+               pCancelButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
+                               ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
                pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
                pCancelButton->AddActionEventListener(*this);
 
@@ -258,7 +255,7 @@ AlbumListEditorForm::CreateIconListView(void)
 
        __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
 
-       AddControl(*__pEditorFolderIconList);
+       AddControl(__pEditorFolderIconList);
 
        __pEditorFolderIconList->SetShowState(true);
 
@@ -283,9 +280,9 @@ AlbumListEditorForm::CreateItem(int index)
        Bitmap* pEditAlbumBitmap = null;
        Bitmap* pBitmapRenameBg = null;
        Bitmap* pBitmapRename = null;
-       String albumName ;
-       int canvasWidth = 64;
-       int canvasHeight = 64;
+       String albumName;
+       int canvasWidth = 75;
+       int canvasHeight = 75;
 
        IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
 
@@ -336,8 +333,8 @@ AlbumListEditorForm::CreateItem(int index)
 
                pEditAlbumCanvas = new (std::nothrow) Canvas();
                pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
-               pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRenameBg);
-               pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRename);
+               pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg);
+               pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename);
 
 
                pEditAlbumBitmap = new (std::nothrow) Bitmap();
@@ -345,8 +342,9 @@ AlbumListEditorForm::CreateItem(int index)
                if (pEditAlbumBitmap != NULL)
                {
                        pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
-                       delete pEditAlbumCanvas;
+
                }
+               delete pEditAlbumCanvas;
 
                albumName = pAlbumInfo->GetAlbumName();
                String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
@@ -370,6 +368,15 @@ AlbumListEditorForm::CreateItem(int index)
                }
        }
 
+       if (pBitmapRenameBg)
+       {
+               delete pBitmapRenameBg;
+       }
+       if (pBitmapRename)
+       {
+               delete pBitmapRename;
+       }
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return pIconListviewItem;
@@ -428,7 +435,7 @@ AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconList
        pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
        pSelectedIndex->Add(new (std::nothrow) Integer(index));
 
-       if( __pEditorFolderIconList->IsItemChecked(index) == false )
+       if (__pEditorFolderIconList->IsItemChecked(index) == false)
        {
                __pEditorFolderIconList->SetItemChecked(index,true);
        }
@@ -556,11 +563,11 @@ AlbumListEditorForm::GetCheckedFolderCount(void) const
        int maxCount = __pPresentationModel->GetFolderCount();
        int count = 0;
 
-       for (int i = 0 ; i < maxCount; ++i)
+       for (int i = 0; i < maxCount; ++i)
        {
                if (__pEditorFolderIconList->IsItemChecked (i))
                {
-                       count++;
+                       ++count;
                }
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -597,7 +604,7 @@ AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
        case IDA_FOOTER_SHARE:
        {
 
-               if__pShareContextMenu != NULL)
+               if (__pShareContextMenu != NULL)
                {
                        delete __pShareContextMenu;
                        __pShareContextMenu = null;
@@ -672,7 +679,7 @@ AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
 
        __checkedCount = GetCheckedFolderCount();
 
-       if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
+       if (previousSceneId == IDSCN_ALBUM_NAME_EDITOR)
        {
 
                if (__checkedCount ==  0)
@@ -689,7 +696,7 @@ AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
        {
                __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
 
-               for ( int index = 0 ; index < count ; index++ )
+               for (int index = 0; index < count; ++index)
                {
                        __pEditorFolderIconList->SetItemChecked(index,false);
                }
@@ -712,11 +719,11 @@ AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const Sce
        AppLogDebug("ENTER");
        __pPresentationModel->RemoveContentEventListener(*this);
 
-       if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR )
+       if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR)
        {
                int loopCount = __pPresentationModel->GetFolderCount();
 
-               for( int count = 0 ; count < loopCount ; count++ )
+               for (int count = 0; count < loopCount; ++count)
                {
                        __pEditorFolderIconList->SetItemChecked(count,false);
                }
@@ -758,18 +765,20 @@ void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum Fi
        SceneManager* pSceneManager = SceneManager::GetInstance();
        AppAssert(pSceneManager);
        pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 bool AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
 {
        AppLogDebug("ENTER");
 
-       if(keyEventInfo.GetKeyCode() == KEY_BACK)
+       if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACKSPACE)
        {
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Show();
        }
-       return true;
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+       return false;
 }
 
 result
@@ -979,14 +988,14 @@ AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tize
 
        IList* pIndexList = GetItemCheckedIndexListN();
 
-       if( __pEditorFolderIconList != null )
+       if (__pEditorFolderIconList != null)
        {
                RemoveControl(__pEditorFolderIconList);
        }
 
        __pEditorFolderIconList = new IconListView();
 
-       if( orientationStatus == ORIENTATION_STATUS_PORTRAIT )
+       if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
        {
                __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
                    Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
@@ -1020,17 +1029,15 @@ AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tize
        __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
        __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
 
-       AddControl(*__pEditorFolderIconList);
+       AddControl(__pEditorFolderIconList);
 
        int loopCount = pIndexList->GetCount();
-       int index = -1 ;
-       for(int count = 0 ; count < loopCount; count ++)
+       int index = -1;
+       for (int count = 0; count < loopCount; ++count)
        {
                Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
                 index = pRealIndex->ToInt();
                __pEditorFolderIconList->SetItemChecked(index, true);
                __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
        }
-
 }
-