2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * Created on: Apr, 2014
23 #ifndef ABSTRACTFAVORITESERVICE_H
24 #define ABSTRACTFAVORITESERVICE_H
26 #include "browser_config.h"
28 #include "AbstractService.h"
29 #include "service_macros.h"
30 #include "BookmarkItem.h"
31 #include "BrowserImage.h"
32 #include "StorageService.h"
33 #include "Config/Config.h"
35 namespace tizen_browser{
38 class AbstractFavoriteService
39 : public tizen_browser::core::AbstractService
44 * @brief Add page to bookmarks
46 * @param address Webpage url.
47 * @param tittle Title of bookmark.
48 * @param note Bookmark note, default is empty .
49 * @param dirId Directory numeric ID, default is 0.
50 * @param thumbnail Page thumbnail, default is empty image.
51 * @param favicon Page favicon image, default is empty image.
53 * @return BookmarkItem class
55 virtual std::shared_ptr<tizen_browser::services::BookmarkItem> addToBookmarks(const std::string & address,
56 const std::string & tittle,
57 const std::string & note = std::string(),
58 std::shared_ptr<tizen_browser::tools::BrowserImage> thumbnail=std::shared_ptr<tizen_browser::tools::BrowserImage>(),
59 std::shared_ptr<tizen_browser::tools::BrowserImage> favicon = std::shared_ptr<tizen_browser::tools::BrowserImage>(),
60 unsigned int dirId = 0) = 0;
62 * @brief Creates a new folder with name "title" in a folder with id, parent_id
63 * @return folder_id of created folder
65 virtual int save_folder(const char *title, int *saved_bookmark_id, int parent_id=0, int by_operator=0)=0;
68 * @brief get folder id of a folder with name "title" in folder with id, parent_id
69 * @return true if found, false otherwise
71 virtual bool get_folder_id(const char *title, int parent_id, int *folder_id) = 0 ;
74 * @brief Count bookmarks and subfolders
75 * @return Number of bookmarks and subfolders
77 virtual int countBookmarksAndSubFolders() = 0;
79 /** \todo Need to change this callback function for finding stored bookmark, check getBookmarkId function
80 * @brief Check if bookmark exists
82 * @param url url to find
83 * @return true if exists, false if not
85 virtual bool bookmarkExists(const std::string & url)= 0;
88 * @brief Get bookmarks in a folder from platform service and store it in private m_bookmarksList
90 * @return list of bookmark items in folder with id, folder_id
92 virtual std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> > getBookmarks(int folder_id = 0)= 0;
95 * @brief Get bookmark folders from platform service and store it in private m_bookmarkFoldersList
97 * @return list of bookmark folders
99 virtual std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> > getBookmarkFolders()= 0;
102 * @brief Delete all bookmarks
104 * @return true if success, false on error
106 virtual bool deleteAllBookmarks() = 0;
109 * @brief Delete bookmark by given url
111 * @param url of bookmark to delete
112 * @return true if success, false on error of not found bookmark
114 virtual bool deleteBookmark(const std::string & url) = 0;
117 virtual void synchronizeBookmarks() = 0;
119 boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::BookmarkItem>)> bookmarkAdded;
120 boost::signals2::signal<void (const std::string& uri)> bookmarkDeleted;
121 boost::signals2::signal<void ()> bookmarksDeleted;
128 #endif // FAVORITESERVICE_H