3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 /*@file: IntBookmark.cpp
20 *@brief: Used to define bookmark
24 #include "IntBookmarkData.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Media;
28 using namespace Tizen::Graphics;
30 BookmarkData::BookmarkData(void)
32 , __bookmarkType(BOOKMARK_TYPE_URL)
38 , __pFavIconData(null)
42 __createdTime.SetValue(0, 0, 0);
43 __modifiedTime.SetValue(0, 0, 0);
46 BookmarkData::BookmarkData(const BookmarkData& bookmark)
48 __bookmarkId = bookmark.__bookmarkId;
49 __bookmarkType = bookmark.__bookmarkType;
50 __bookmarkTitle = bookmark.__bookmarkTitle;
51 __bookmarkUrl = bookmark.__bookmarkUrl;
52 __parentId = bookmark.__parentId;
53 __iconPath=bookmark.__iconPath;
54 __faviconId=bookmark.__faviconId;
57 BookmarkData::~BookmarkData(void)
63 BookmarkData::operator =(const BookmarkData& rhs)
67 __bookmarkId = rhs.__bookmarkId;
68 __bookmarkType = rhs.__bookmarkType;
69 __bookmarkTitle = rhs.__bookmarkTitle;
70 __bookmarkUrl = rhs.__bookmarkUrl;
71 __parentId = rhs.__parentId;
72 __iconPath = rhs.__iconPath;
73 __faviconId = rhs.__faviconId;
79 BookmarkData::GetBookmarkId(void)
85 BookmarkData::GetBookmarkType(void)
87 if (__bookmarkUrl.GetLength() > 0)
88 __bookmarkType = BOOKMARK_TYPE_URL;
90 __bookmarkType = BOOKMARK_TYPE_FOLDER;
91 return __bookmarkType;
95 BookmarkData::GetBookmarkTitle(void)
97 return __bookmarkTitle;
101 BookmarkData::GetUrl(void)
103 return __bookmarkUrl;
107 BookmarkData::GetParentId(void)
113 BookmarkData::GetCreatedTime(void)
115 return __createdTime;
119 BookmarkData::GetModifiedTime(void)
121 return __modifiedTime;
125 BookmarkData::GetIconPath(void)
131 BookmarkData::GetFaviconId(void)
137 BookmarkData::SetBookmarkId(const String& strBookmarkId)
139 __bookmarkId = strBookmarkId;
143 BookmarkData::SetBookmarkTitle(String& strTitle)
146 __bookmarkTitle = strTitle;
149 void BookmarkData::SetBookmarkType(type bookmarkType)
151 __bookmarkType = bookmarkType;
155 BookmarkData::SetUrl(const String& strUrl)
157 __bookmarkUrl = strUrl;
161 BookmarkData::SetParentId(const String& strParentID)
163 __parentId = strParentID;
167 BookmarkData::SetCreatedTime(const DateTime& strCreatedTime)
169 __createdTime = strCreatedTime;
173 BookmarkData::SetModifiedTime(const DateTime& strModifiedTime)
175 __modifiedTime = strModifiedTime;
179 BookmarkData::SetIconPath(const String& strFilePath)
181 __iconPath = strFilePath;
185 BookmarkData::SetFaviconId(const String& strFaviconId)
187 __faviconId = strFaviconId;
191 BookmarkData::SetFavIconBitmap(Tizen::Graphics::Bitmap& favIconImage)
193 Image* pImage = null;
194 // ByteBuffer* pEncodedBuffer = null;
196 __favIconWidth = favIconImage.GetWidth();
197 __favIconHeight = favIconImage.GetHeight();
199 pImage = new Image();
201 //__pFavIconData = pImage->EncodeToBufferN(favIconImage,Tizen::Media::IMG_FORMAT_PNG);
202 __pFavIconData = pImage->EncodeToBufferN(favIconImage,IMG_FORMAT_PNG);
204 //__pFavIconData = pImage->DecodeToBufferN(*pEncodedBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888, __favIconWidth, __favIconHeight);
210 BookmarkData::SetFavIconBuffer(Tizen::Base::ByteBuffer& favIconBuffer)
212 __pFavIconData = &favIconBuffer;
216 BookmarkData::GetFavIconBuffer()
218 return __pFavIconData;
222 BookmarkData::GetFavIconBitmap()
224 Bitmap *pBitmap = null;
226 if (__pFavIconData != null)
228 Image *pImage = new(std::nothrow) Image();
230 pBitmap = pImage->DecodeN(*__pFavIconData, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
238 int BookmarkData::GetFavIconWidth()
240 return __favIconWidth;
243 int BookmarkData::GetFavIconHeight()
245 return __favIconHeight;
249 BookmarkData::SetFavIconWidth(int favIconWidth)
251 __favIconWidth = favIconWidth;
255 BookmarkData::SetFavIconHeight(int favIconHeight)
257 __favIconHeight = favIconHeight;