Fixed prevent issue
[apps/osp/Gallery.git] / src / GlAlbumInfo.cpp
index fbac422..5225570 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -27,18 +27,11 @@ using namespace Tizen::Base::Collection;
 using namespace Tizen::Content;
 using namespace Tizen::Graphics;
 
-static const int FORMAT_BUFFER_SIZE = 256;
-
 AlbumInfo::AlbumInfo(void)
-       : __albumName(EMPTY_SPACE)
-       , __pDirectoryFullPathList(null)
+       : __pDirectoryFullPathList(null)
        , __pContentIdList(null)
-       , __folderThumnailBitmapCount(0)
+       , __pFolderThumnailBitmap(null)
 {
-       for (int i = 0; i < FOLDER_BITMAP_MAX; ++i)
-       {
-               __pFolderThumnailBitmap[i] = null;
-       }
 }
 
 AlbumInfo::~AlbumInfo(void)
@@ -53,12 +46,9 @@ AlbumInfo::~AlbumInfo(void)
                delete __pContentIdList;
        }
 
-       for (int i = 0; i < FOLDER_BITMAP_MAX; ++i)
+       if (__pFolderThumnailBitmap != null)
        {
-               if (__pFolderThumnailBitmap[i] != null)
-               {
-                       delete __pFolderThumnailBitmap[i];
-               }
+               delete __pFolderThumnailBitmap;
        }
 }
 
@@ -112,7 +102,6 @@ AlbumInfo::GetDirectoryListN(void) const
                pDirectoryFullPathList->Add(pItem);
        }
        delete pEnum;
-       pEnum = null;
 
        return pDirectoryFullPathList;
 }
@@ -124,6 +113,7 @@ AlbumInfo::ClearDirectoryList(void)
        {
                delete __pDirectoryFullPathList;
        }
+
        __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
 }
 
@@ -163,7 +153,6 @@ AlbumInfo::AppendDirectoryList(const ICollection& directoryList)
                __pDirectoryFullPathList->Add(pItem);
        }
        delete pEnum;
-       pEnum = null;
 }
 
 int
@@ -197,7 +186,6 @@ AlbumInfo::GetContentIdListN(void) const
                pContentIdList->Add(pItem);
        }
        delete pEnum;
-       pEnum = null;
 
        return pContentIdList;
 }
@@ -216,14 +204,12 @@ AlbumInfo::Construct(void)
        __pDirectoryFullPathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        result r = E_SUCCESS;
-       if (GetLastResult() == E_SUCCESS && __pDirectoryFullPathList != null && __pContentIdList != null)
-       {
-               r = E_SUCCESS;
-       }
-       else
+       if (GetLastResult() != E_SUCCESS || __pDirectoryFullPathList == null || __pContentIdList == null)
        {
                delete __pDirectoryFullPathList;
+               __pDirectoryFullPathList = null;
                delete __pContentIdList;
+               __pContentIdList = null;
                r = E_FAILURE;
        }
 
@@ -231,8 +217,8 @@ AlbumInfo::Construct(void)
 }
 
 result
-AlbumInfo::Construct(const String& albumName, ContentType contentType ,
-               const IList& directoryList, const IList& contentIdList)
+AlbumInfo::Construct(const String& albumName, ContentType contentType, const IList& directoryList,
+               const IList& contentIdList)
 {
        if (&albumName == null)
        {
@@ -339,17 +325,6 @@ AlbumInfo::AppendContentIdList(const ICollection& contentIdList)
                __pContentIdList->Add(pItem);
        }
        delete pEnum;
-       pEnum = null;
-
-       int thumnailCount = __pContentIdList->GetCount();
-       if (thumnailCount >= FOLDER_BITMAP_MAX)
-       {
-               __folderThumnailBitmapCount = FOLDER_BITMAP_MAX;
-       }
-       else
-       {
-               __folderThumnailBitmapCount = thumnailCount;
-       }
 }
 
 void
@@ -382,7 +357,7 @@ AlbumInfo::GetContentIdCount(void) const
 }
 
 result
-AlbumInfo::RemoveContentIdAt(int index)
+AlbumInfo::RemoveContentIdAt(const int index)
 {
        result r = E_SUCCESS;
 
@@ -394,81 +369,20 @@ AlbumInfo::RemoveContentIdAt(int index)
        return r;
 }
 
-int
-AlbumInfo::GetFolderThumnailBitmapCount(void) const
-{
-       return __folderThumnailBitmapCount;
-}
-
 void
-AlbumInfo::AppendFolderThumnailBitmap(Bitmap* FolderThumnailBitmap, int index)
+AlbumInfo::SetFolderThumnailBitmap(Bitmap* pFolderThumnailBitmap)
 {
-       if (index >= FOLDER_BITMAP_MAX)
-       {
-               return;
-       }
-
-       __pFolderThumnailBitmap[index] = FolderThumnailBitmap;
+       __pFolderThumnailBitmap = pFolderThumnailBitmap;
 }
 
 Bitmap*
-AlbumInfo::GetFolderThumnailBitmap(int index)
-{
-       if (index >= FOLDER_BITMAP_MAX)
-       {
-               return null;
-       }
-
-       return __pFolderThumnailBitmap[index];
-}
-
-int
-AlbumInfo::GetEmptyBitmapIndex(void)
-{
-       int empty = FOLDER_BITMAP_MAX;
-
-       for (int i = 0; i < __folderThumnailBitmapCount; ++i)
-       {
-               if (i >= FOLDER_BITMAP_MAX)
-               {
-                       break;
-               }
-
-               if (__pFolderThumnailBitmap[i] == null)
-               {
-                       empty = i;
-                       break;
-               }
-       }
-       return empty;
-}
-
-String
-AlbumInfo::GetCreateDateString(void) const
-{
-       return __createFileDateString;
-}
-
-void
-AlbumInfo::SetCreateDateString(String& strMinimumDate, String& strMaximumDate)
+AlbumInfo::GetFolderThumnailBitmap(void) const
 {
-       String resultTime;
-
-       if (strMinimumDate == strMaximumDate)
-       {
-               resultTime.Format(FORMAT_BUFFER_SIZE, L"%ls", strMaximumDate.GetPointer());
-       }
-       else
-       {
-               resultTime.Format(FORMAT_BUFFER_SIZE, L"%ls - %ls", strMinimumDate.GetPointer(),
-                               strMaximumDate.GetPointer());
-       }
-
-       __createFileDateString = resultTime;
+       return __pFolderThumnailBitmap;
 }
 
 AlbumInfoType
-AlbumInfo::GetAlbumInfoType(void)
+AlbumInfo::GetAlbumInfoType(void) const
 {
        return ALBUM_INFO_TYPE_FOLDER;
 }