Task TT-75 Implement "Main page loading UI" view
[profile/tv/apps/web/browser.git] / core / AbstractInterfaces / AbstractFavoriteService.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /*
18  *
19  * Created on: Apr, 2014
20  *     Author: m.kielak
21  */
22
23 #ifndef ABSTRACTFAVORITESERVICE_H
24 #define ABSTRACTFAVORITESERVICE_H
25
26 #include "browser_config.h"
27
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"
34
35 namespace tizen_browser{
36 namespace interfaces{
37
38 class AbstractFavoriteService
39         : public tizen_browser::core::AbstractService
40 {
41 public:
42
43     /**
44      * @brief Add page to bookmarks
45      *
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.
52      *
53      * @return BookmarkItem class
54      */
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;
61    /**
62      * @brief Creates a new folder with name "title" in a folder with id, parent_id
63      * @return folder_id of created folder
64      */
65     virtual int save_folder(const char *title, int *saved_bookmark_id, int parent_id=0, int by_operator=0)=0;
66
67    /**
68      * @brief get folder id of a folder with name "title" in folder with id, parent_id
69      * @return  true if found, false otherwise
70      */
71     virtual bool get_folder_id(const char *title, int parent_id, int *folder_id) = 0 ;
72
73    /**
74      * @brief Count bookmarks and subfolders
75      * @return Number of bookmarks and subfolders
76      */
77     virtual int countBookmarksAndSubFolders() = 0;
78
79     /** \todo Need to change this callback function for finding stored bookmark, check getBookmarkId function
80      * @brief Check if bookmark exists
81      *
82      * @param url url to find
83      * @return true if exists, false if not
84      */
85      virtual bool bookmarkExists(const std::string & url)= 0;
86
87     /**
88      * @brief Get bookmarks in a folder from platform service and store it in private m_bookmarksList
89      *
90      * @return list of bookmark items in folder with id, folder_id
91      */
92     virtual std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> > getBookmarks(int folder_id = 0)= 0;
93
94     /**
95      * @brief Get bookmark folders from platform service and store it in private m_bookmarkFoldersList
96      *
97      * @return list of bookmark folders
98      */
99     virtual std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> > getBookmarkFolders()= 0;
100
101     /**
102      * @brief Delete all bookmarks
103      *
104      * @return true if success, false on error
105      */
106     virtual bool deleteAllBookmarks() = 0;
107
108     /**
109      * @brief Delete bookmark by given url
110      *
111      * @param url of bookmark to delete
112      * @return true if success, false on error of not found bookmark
113      */
114     virtual bool deleteBookmark(const std::string & url) = 0;
115
116
117     virtual void synchronizeBookmarks() = 0;
118
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;
122
123 };
124
125 }
126 }
127
128 #endif // FAVORITESERVICE_H