1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
/*
* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __TIZEN_WEB_FAVORITES_H__
#define __TIZEN_WEB_FAVORITES_H__
#include <stdio.h>
#include <stdlib.h>
#include <Evas.h>
#include <tizen.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup CAPI_WEB_FAVORITES_MODULE
* @{
*/
/**
* @brief Enumerations for favorites error.
*/
typedef enum favorites_error{
FAVORITES_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
FAVORITES_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
FAVORITES_ERROR_DB_FAILED = TIZEN_ERROR_WEB_CLASS | 0x62, /**< Database operation failure */
FAVORITES_ERROR_ITEM_ALREADY_EXIST = TIZEN_ERROR_WEB_CLASS | 0x63 /**< Requested data already exists */
} favorites_error_e;
/**
* @brief The structure of bookmark entry in search results.
*
* @details This structure is passed to callback function in all bookmark related
* iterations through list received from search functions.
*
* @see bookmark_foreach_cb()
*/
typedef struct {
char* address; /**< Bookmark URL */
char* title; /**< The title of the bookmark */
char* creation_date; /**< The date of creation */
char* update_date; /**< The last updated date */
char* visit_date; /**< The last visit date */
int id; /**< The unique ID of bookmark */
bool is_folder; /**< property bookmark or folder\n @c true: folder, @c false: bookmark */
int folder_id; /**< The ID of parent folder */
int order_index; /**< The order index of bookmarks when show the list at the browser */
bool editable; /**< The flag of editability\n @c true : writable, @c false: read-only, not ediable */
} favorites_bookmark_entry_s;
/**
* @brief Called to get bookmark details for each found bookmark.
*
* @param[in] item The bookmark entry handle or folder entry handle
* @param[in] user_data The user data passed from the foreach function
*
* @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
*
* @pre favorites_bookmark_foreach() will invoke this callback.
*
* @see favorites_bookmark_foreach()
*/
typedef bool (*favorites_bookmark_foreach_cb)(favorites_bookmark_entry_s *item, void *user_data);
/**
* @brief Adds an entry to bookmark list.
*
* @remarks If a folder named @a "foldername" doesn't exist, it will be created.
* @remarks The folder named "Bookmarks" is reserved for the root folder.
* @param[in] url Book URL
* @param[in] title The title of the bookmark
* @param[in] folder_name The name of parent folder
* @param[out] bookmark_id: The unique id of the added bookmark
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_ITEM_ALREADY_EXIST Requested data already exists
*
*/
int favorites_bookmark_add_bookmark(const char *url, const char *title, const char *folder_name, int *bookmark_id);
/**
* @brief Deletes the bookmark item of given bookmark id.
*
* @param[in] bookmark_id The unique ID of bookmark to delete
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_bookmark_delete_bookmark(int bookmark_id);
/**
* @brief Deletes all bookmarks and sub folders.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_bookmark_delete_all_bookmarks(void);
/**
* @brief Gets a number of bookmark list items.
*
* @param[out] count The number of bookmarks and sub folders.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
*
*/
int favorites_bookmark_get_count(int *count);
/**
* @brief Retrieves all bookmarks and folders by invoking the given callback function iteratively.
*
* @remarks All bookmarks and folders data are also used by browser application
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
* @post This function invokes bookmark_foreach_cb() repeatedly for each bookmark.
*
* @see bookmark_foreach_cb()
*/
int favorites_bookmark_foreach(favorites_bookmark_foreach_cb callback, void *user_data);
/**
* @brief Exports a whole bookmark list as a netscape HTML bookmark file.
*
* @param[in] file_path The absolute path of the export file. This must includes html file name.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_bookmark_export_list(const char *file_path);
/**
* @brief Gets the bookmark's favicon as a evas object type
*
* @param[in] bookmark_id The unique ID of bookmark
* @param[in] evas The given canvas
* @param[out] icon Retrieved favicon evas object of bookmark.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_bookmark_get_favicon(int bookmark_id, Evas *evas, Evas_Object **icon);
/**
* @brief The structure of history entry in search results.
*
* @details This structure is passed to callback function in all history related
* iterations through list received from search functions.
*
* @see history_foreach_cb()
*/
typedef struct {
char* address; /**< URL history */
char* title; /**< The title of history */
int count; /**< The visit count */
char* visit_date; /**< The last visit date */
int id; /**< The unique ID of history */
} favorites_history_entry_s;
/**
* @brief Called to get history details for each found history.
*
* @param[in] item The history entry handle
* @param[in] user_data The user data passed from the foreach function
*
* @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
*
* @pre favorites_history_foreach() will invoke this callback.
*
* @see favorites_history_foreach()
*/
typedef bool (*favorites_history_foreach_cb)(favorites_history_entry_s *item, void *user_data);
/**
* @brief Gets a number of history list items.
*
* @param[out] count The number of histories.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
*
*/
int favorites_history_get_count(int *count);
/**
* @brief Retrieves all histories by invoking the given callback function iteratively.
*
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
* @post This function invokes history_foreach_cb().
*
* @see history_foreach_cb()
*/
int favorites_history_foreach(favorites_history_foreach_cb callback, void *user_data);
/**
* @brief Deletes the history item of given history id.
*
* @param[in] history_id The history ID to delete
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_history_delete_history(int history_id);
/**
* @brief Deletes the history item of given history url.
*
* @param[in] url history url which wants to be deleted
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_history_delete_history_by_url(const char *url);
/**
* @brief Deletes all histories.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_history_delete_all_histories(void);
/**
* @brief Deletes all histories accessed with the browser within the specified time period.
*
* @param[in] begin_date The start date of the period
* @param[in] end_date The end date of the period
*
* @remarks Date format must be "yyyy-mm-dd hh:mm:ss" ex: "2000-01-01 01:20:35".
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_history_delete_history_by_term(const char *begin_date, const char *end_date);
/**
* @brief Gets the history's favicon as an evas object type
*
* @param[in] history_id The unique ID of history item
* @param[in] evas The given canvas
* @param[out] icon Retrieved favicon evas object of bookmark.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FAVORITES_ERROR_NONE Successful
* @retval #FAVORITES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #FAVORITES_ERROR_DB_FAILED Database failed
*
*/
int favorites_history_get_favicon(int history_id, Evas *evas, Evas_Object **icon);
/**
* @}
*/
#ifdef __cplusplus
};
#endif
#endif /* __TIZEN_WEB_FAVORITES_H__ */
|