Fixed Nabi Issues and poppup alignment changes
[apps/osp/Internet.git] / inc / IntBookmarkPresentationModel.h
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 //!Internet
19 /*@file: IntBookmarkPresentationModel.h
20  *@brief: This is the header file for BookmarkPresentationModel class
21  */
22
23 #ifndef _INT_BOOKMARK_PRESENTATION_MODEL_H
24 #define _INT_BOOKMARK_PRESENTATION_MODEL_H
25
26 #include <FAppApp.h>
27 #include <FBase.h>
28 #include <FIo.h>
29
30 #include "IntBookmarkData.h"
31 #include "IntPresentationModelBase.h"
32 #include "IntTypes.h"
33
34 enum {
35         BOOKMARK_ID = 0,
36         BOOKMARK_TYPE,
37         BOOKMARK_PARENT,
38         BOOKMARK_ADDRESS,
39         BOOKMARK_TITLE,
40         BOOKMARK_CREATIONDATE,
41         BOOKMARK_SEQUENCE,
42         BOOKMARK_UPDATEDATA,
43         BOOKMARK_VISITDATE,
44         BOOKMARK_EDITABLE,
45         BOOKMARK_ACCESSACCOUNT,
46         BOOKMARK_FAVICON,
47         BOOKMARK_FAVICON_LENGTH,
48         BOOKMARK_FAVICON_W,
49         BOOKMARK_FAVICON_H,
50         BOOKMARK_CREATED_DATE,
51         BOOKMARK_ACCOUNT_NAME,
52         BOOKMARK_ACCOUNT_TYPE,
53         BOOKMARK_THUMBNAIL,
54         BOOKMARK_THUMBNAIL_LENGTH,
55         BOOKMARK_THUMBNAIL_W,
56         BOOKMARK_THUMBNAIL_H,
57         BOOKMARK_VERSION,
58         BOOKMARK_SYNC,
59         BOOKMARK_TAG1,
60         BOOKMARK_TAG2,
61         BOOKMARK_TAG3,
62         BOOKMARK_TAG4,
63         /*HISTORY_ICON_PATH,
64         HISTORY_FAVICONID,
65         HISTORY_THUMBNAIL,
66         HISTORY_BOOKMARK_ID,
67         HISTORY_VISITED_COUNT*/
68 };
69
70 /**
71  * @class BookmarkPresentationModel
72  * @brief This class declares functions which will manage database
73  */
74 class BookmarkPresentationModel
75 :public PresentationModelBase
76  {
77 public:
78         /**
79          * @brief               The method used to get the already created instance of the FaviconManager
80          */
81         static BookmarkPresentationModel* GetInstance(void);
82         /**
83          * This function deletes the bookmark from the bookmark table
84          *
85          * @return      An error code
86          * @param               bookmarkId              The bookmarkId
87          * @exception   E_SUCCESS               The bookmark is successfully deleted
88          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
89          */
90         result DeleteBookmark(int bookmarkId);
91
92         /**
93          * This function deletes the bookmark from the bookmark table
94          *
95          * @return      An error code
96          * @param               url                 URL of the bookmark
97          * @exception   E_SUCCESS               The bookmark is successfully deleted
98          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
99          */
100         result DeleteBookmark(const Tizen::Base::String& url);
101
102         /**
103          * This function deletes the bookmark from the bookmark table
104          *
105          * @return      An error code
106          * @param               folderId                The folderID
107          * @exception   E_SUCCESS               The bookmark is successfully deleted
108          * @exception   E_FAILURE               The bookmark deletion is unsuccessful
109          */
110         result DeleteBookmarkByFolderId(int folderId);
111
112         /**
113          * This function deletes the folder from the folder table
114          *
115          * @return      An error code
116          * @param               bookmarkId              The folderId
117          * @exception   E_SUCCESS               The folder is successfully deleted
118          * @exception   E_FAILURE               The folder deletion is unsuccessful
119          */
120         result DeleteFolder(int folderId);
121
122
123         /**
124          * This function checks whether the Bookmark with given URl already exists or not
125          *
126          * @return      An error code
127          * @param               URl
128          * @exception   E_SUCCESS               The method is successful
129          * @exception   E_FAILURE               The method is not successful as the list is not being created
130          * @remarks             To check whether the Bookmark with given URl already exists or not
131          */
132         result DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const Tizen::Base::String& parentId = L"-1", bool checkParentId = false);
133         /**
134          * This function selects the bookmarks from the table
135          *
136          * @return      An error code
137          * @param               parentID                parentId for bookmark : Folder or URL
138          * @param               startIndex              the OFFSET value
139          * @param               limit                   The LIMIT till which the select statement will be executed
140          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
141          */
142         result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
143
144
145         /**
146          * This function returns the no of bookmarks
147          *
148          * @return      An error code
149          * @param               parentID                Folder or URL
150          */
151         result GetBookmarkCount(const Tizen::Base::String& parentID, int& count);
152
153         /**
154          * This function selects the bookmark folders  from the table
155          *
156          * @return      An error code
157          * @param               parentID                parentId for bookmark : Folder or URL
158          * @param               startIndex              the OFFSET value
159          * @param               limit                   The LIMIT till which the select statement will be executed
160          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
161          */
162         result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
163
164
165         /**
166          * This function returns the no of bookmark folders
167          *
168          * @return      An error code
169          * @param               parentID                Folder or URL
170          */
171         result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count);
172
173         /**
174          * This function selects the bookmark folders from the table
175          *
176          * @return      An error code
177          * @param               parentID                parentId for bookmark : Folder or URL
178          * @param               startIndex              the OFFSET value
179          * @param               limit                   The LIMIT till which the select statement will be executed
180          * @param               bookmarkList    The arraylist where the selected bookmarks will be saved
181          */
182         result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
183
184         /**
185          * This function returns the no of bookmark folders.
186          *
187          * @return      An error code
188          * @param               parentID                Folder or URL
189          */
190         result GetFolderCount(const Tizen::Base::String& parentID, int& count);
191
192         /**
193          * This function selects the searched bookmarks from the table
194          *
195          * @return      An error code
196          * @param               startIndex              the OFFSET value
197          * @param               limit                   The LIMIT till which the select statement will be executed
198          * @param               BookmarkList            The arraylist where the selected searched bookmarks will be saved
199          */
200         result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
201
202
203         /**
204          * This function returns the no of searched Bookmarks
205          *
206          * @return      An error code
207          * @param               count                   The no of matching bookmarks will be returned in count.
208          */
209         result GetSearchBookmarkCount(int& count, Tizen::Base::String& text);
210
211         /**
212          * This function selects the searched folders from the table
213          *
214          * @return      An error code
215          * @param               startIndex              the OFFSET value
216          * @param               limit                   The LIMIT till which the select statement will be executed
217          * @param               FolderList              The arraylist where the selected searched folders will be saved
218          */
219         result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text);
220
221         /**
222          * This function returns the no of searched Bookmarks and Folders
223          *
224          * @return      An error code
225          * @param               count                   The no of matching bookmarks and folders will be returned in count.
226          */
227         result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text);
228
229         /**
230          * This function returns the no of searched Folders
231          *
232          * @return      An error code
233          * @param               count                   The no of matching Folders will be returned in count.
234          */
235         result GetSearchFolderCount(int& count, Tizen::Base::String& text);
236
237         /**
238          * This function selects the searched bookmark folders from the table
239          *
240          * @return      An error code
241          * @param               startIndex              the OFFSET value
242          * @param               limit                   The LIMIT till which the select statement will be executed
243          * @param               BookmarkList            The arraylist where the selected searched bookmarks will be saved
244          */
245         result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text);
246
247         /**
248          * This function adds the folder to the folder table
249          *
250          * @return      An error code
251          * @param               bookmark                The folder
252          * @exception   E_SUCCESS               The folder is inserted successfully to the table
253          * @exception   E_FAILURE               The folder is not inserted successfully
254          */
255         result SaveFolder(BookmarkData& bookmark);
256
257         /**
258          * This function adds the bookmarks to the bookmark table
259          *
260          * @return      An error code
261          * @param               bookmark                The bookmark
262          * @exception   E_SUCCESS               The bookmark is inserted successfully to the table
263          * @exception   E_FAILURE               The bookmark is not inserted successfully
264          */
265         result SaveBookmark(BookmarkData& bookmark);
266
267         result SaveTempBookmark(BookmarkData& bookmark);
268 private:
269         /**
270          * @brief The Default Constructor
271          */
272         BookmarkPresentationModel(void);
273
274         /**
275         * @brief                The Default Destructor
276         */
277         ~BookmarkPresentationModel(void);
278
279         /**
280          * copy constructor
281          */
282         BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj);
283
284         /**
285          * assignment operator
286          */
287
288         BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj);
289
290         /**
291          *@brief Initialize storage service
292          */
293         result Construct(void);
294
295         /**
296          * @brief               The method used to create the instance of the SettingsManager class
297          */
298         static void CreateInstance(void);
299
300         /**
301          * @brief               The method used to remove the already created instance of the SettingsManager
302          */
303         static void DestroyInstance(void);
304
305         /**
306          * This function creates the list of BookMark
307          *
308          * @return      An error code
309          * @param               nBookmarkCount  The no of BookMark present
310          * @param               bookmarkList    An ArrayList where the BookMark will be stored
311          * @exception   E_SUCCESS               The method is successful
312          * @exception   E_FAILURE               The method is not successful as the list is not being created
313          * @remarks             To work properly , the bookmark count and and existing list should be passed
314          */
315         result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
316         /**
317          * This function creates the list of BookMark folders
318          *
319          * @return      An error code
320          * @param               bookmarkCount  The no of BookMark folders present
321          * @param               bookmarkList    An ArrayList where the BookMark will be stored
322          * @exception   E_SUCCESS               The method is successful
323          * @exception   E_FAILURE               The method is not successful as the list is not being created
324          * @remarks             To work properly , the bookmark count and and existing list should be passed
325          */
326
327         result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList);
328
329 private:
330         static BookmarkPresentationModel* __pBookmarkPresentationModel;
331
332  };
333
334 #endif //_INT_BOOKMARK_PRESENTATION_MODEL_H