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)
40 __createdTime.SetValue(0, 0, 0);
41 __modifiedTime.SetValue(0, 0, 0);
44 BookmarkData::BookmarkData(const BookmarkData& bookmark)
46 __bookmarkId = bookmark.__bookmarkId;
47 __bookmarkType = bookmark.__bookmarkType;
48 __bookmarkTitle = bookmark.__bookmarkTitle;
49 __bookmarkUrl = bookmark.__bookmarkUrl;
50 __parentId = bookmark.__parentId;
51 __iconPath=bookmark.__iconPath;
52 __faviconId=bookmark.__faviconId;
55 BookmarkData::~BookmarkData(void)
61 BookmarkData::operator =(const BookmarkData& rhs)
65 __bookmarkId = rhs.__bookmarkId;
66 __bookmarkType = rhs.__bookmarkType;
67 __bookmarkTitle = rhs.__bookmarkTitle;
68 __bookmarkUrl = rhs.__bookmarkUrl;
69 __parentId = rhs.__parentId;
70 __iconPath = rhs.__iconPath;
71 __faviconId = rhs.__faviconId;
77 BookmarkData::GetBookmarkId(void)
83 BookmarkData::GetBookmarkType(void)
85 if (__bookmarkUrl.GetLength() > 0)
86 __bookmarkType = BOOKMARK_TYPE_URL;
88 __bookmarkType = BOOKMARK_TYPE_FOLDER;
89 return __bookmarkType;
93 BookmarkData::GetBookmarkTitle(void)
95 return __bookmarkTitle;
99 BookmarkData::GetUrl(void)
101 return __bookmarkUrl;
105 BookmarkData::GetParentId(void)
111 BookmarkData::GetCreatedTime(void)
113 return __createdTime;
117 BookmarkData::GetModifiedTime(void)
119 return __modifiedTime;
123 BookmarkData::GetIconPath(void)
129 BookmarkData::GetFaviconId(void)
135 BookmarkData::SetBookmarkId(const String& strBookmarkId)
137 __bookmarkId = strBookmarkId;
141 BookmarkData::SetBookmarkTitle(String& strTitle)
144 __bookmarkTitle = strTitle;
147 void BookmarkData::SetBookmarkType(type bookmarkType)
149 __bookmarkType = bookmarkType;
153 BookmarkData::SetUrl(const String& strUrl)
155 __bookmarkUrl = strUrl;
159 BookmarkData::SetParentId(const String& strParentID)
161 __parentId = strParentID;
165 BookmarkData::SetCreatedTime(const DateTime& strCreatedTime)
167 __createdTime = strCreatedTime;
171 BookmarkData::SetModifiedTime(const DateTime& strModifiedTime)
173 __modifiedTime = strModifiedTime;
177 BookmarkData::SetIconPath(const String& strFilePath)
179 __iconPath = strFilePath;
183 BookmarkData::SetFaviconId(const String& strFaviconId)
185 __faviconId = strFaviconId;
189 BookmarkData::SetFavIconBitmap(Tizen::Graphics::Bitmap& favIconImage)
191 Image* pImage = null;
192 // ByteBuffer* pEncodedBuffer = null;
194 __favIconWidth = favIconImage.GetWidth();
195 __favIconHeight = favIconImage.GetHeight();
197 pImage = new Image();
199 //__pFavIconData = pImage->EncodeToBufferN(favIconImage,Tizen::Media::IMG_FORMAT_PNG);
200 __pFavIconData = pImage->EncodeToBufferN(favIconImage,IMG_FORMAT_PNG);
202 //__pFavIconData = pImage->DecodeToBufferN(*pEncodedBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888, __favIconWidth, __favIconHeight);
208 BookmarkData::SetFavIconBuffer(Tizen::Base::ByteBuffer& favIconBuffer)
210 __pFavIconData = &favIconBuffer;
214 BookmarkData::GetFavIconBuffer()
216 return __pFavIconData;
220 BookmarkData::GetFavIconBitmap()
222 Bitmap *pBitmap = null;
224 if (__pFavIconData != null)
226 Image *pImage = new(std::nothrow) Image();
228 pBitmap = pImage->DecodeN(*__pFavIconData, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
236 int BookmarkData::GetFavIconWidth()
238 return __favIconWidth;
241 int BookmarkData::GetFavIconHeight()
243 return __favIconHeight;
247 BookmarkData::SetFavIconWidth(int favIconWidth)
249 __favIconWidth = favIconWidth;
253 BookmarkData::SetFavIconHeight(int favIconHeight)
255 __favIconHeight = favIconHeight;