Fix : Extract the gps information according to a locale
[platform/framework/native/content.git] / src / FCnt_ImageContentInfoImpl.cpp
index 5559904..32ff68f 100644 (file)
@@ -41,8 +41,10 @@ namespace Tizen { namespace Content
 _ImageContentInfoImpl::_ImageContentInfoImpl(void)
        : __width(0)
        , __height(0)
+       , __isBurst(false)
        , __orientationType(IMAGE_ORIENTATION_TYPE_UNKNOWN)
        , __title(L"")
+       , __burstShotId(L"")
 {
 
 }
@@ -68,11 +70,31 @@ result
 _ImageContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
 {
        result r = E_SUCCESS;
-       int contentLength = 0;
-       FileAttributes attribute;
+       String tempPath(contentPath);
+
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+               {
+                       // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+                       // it should be converted in 2.0.
+                       r = tempPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+               }
+               else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+               {
+                       r = tempPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+                       SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+               }
+               else
+               {
+                       SysLogException(NID_CNT, E_INVALID_ARG,
+                                       "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+                       return E_INVALID_ARG;
+               }
+       }
 
        // checks parameters
-       contentLength = contentPath.GetLength();
        SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
                        "The contentPath should start with /Media or /Storagecard/Media.");
        SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
@@ -89,7 +111,7 @@ _ImageContentInfoImpl::Construct(const String& contentPath, const String& thumbn
                SysLog(NID_CNT, "The setGps is not supported.");
        }
 
-       SetContentPath(contentPath);
+       SetContentPath(tempPath);
        SetContentType(CONTENT_TYPE_IMAGE);
 
        return r;
@@ -139,7 +161,7 @@ _ImageContentInfoImpl::Construct(const String* pContentPath)
                int length = contentPath.GetLength();
                SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
                                "The length of pContentPath is 0.");
-               SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+               SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND,
                                "The file corresponding to pContentPath could not be found.");
 
                SetContentPath(contentPath);
@@ -171,6 +193,12 @@ _ImageContentInfoImpl::GetOrientation(void) const
        return __orientationType;
 }
 
+DateTime
+_ImageContentInfoImpl::GetImageTakenDate(void) const
+{
+       return __takenDate;
+}
+
 String
 _ImageContentInfoImpl::GetTitle(void) const
 {
@@ -183,6 +211,18 @@ _ImageContentInfoImpl::GetTitle(void) const
        return __title;
 }
 
+bool
+_ImageContentInfoImpl::IsBurstShot(void) const
+{
+       return __isBurst;
+}
+
+String
+_ImageContentInfoImpl::GetBurstShotId(void) const
+{
+       return __burstShotId;
+}
+
 void
 _ImageContentInfoImpl::SetWidth(int width)
 {
@@ -207,4 +247,22 @@ _ImageContentInfoImpl::SetOrientation(const ImageOrientationType& orientationTyp
        __orientationType = orientationType;
 }
 
+void
+_ImageContentInfoImpl::SetImageTakenDate(const DateTime& takenDate)
+{
+       __takenDate = takenDate;
+}
+
+void
+_ImageContentInfoImpl::SetBurstShot(const bool isBurst)
+{
+       __isBurst = isBurst;
+}
+
+void
+_ImageContentInfoImpl::SetBurstShotId(const String& burstShotId)
+{
+       __burstShotId = burstShotId;
+}
+
 }}