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.
20 /*@file: IntHistoryPresentationModel.h
21 *@brief: This is the header file for HistoryPresentationModel class
25 #ifndef _INT_HISTORY_PRESENTATION_MODEL_H
26 #define _INT_HISTORY_PRESENTATION_MODEL_H
33 #include "IntHistoryData.h"
34 #include "IntPresentationModelBase.h"
44 HISTORY_FAVICON_LENGTH,
48 HISTORY_SNAPSHOT_STRIDE,
51 // HISTORY_BOOKMARK_ID,
57 HISTORY_VISITED_COUNT*/
59 //ID INTEGER PRIMARY KEY AUTOINCREMENT, ADDRESS TEXT, TITLE TEXT, COUNTER INTEGER, VISITDATE DATETIME, FAVICON BLOB,
60 //FAVICON_LENGTH INTEGER, FAVICON_W INTEGER, FAVICON_H INTEGER, SNAPSHOT BLOB, SNAPSHOT_STRIDE INTEGER, SNAPSHOT_W INTEGER, SNAPSHOT_H INTEGER
62 * @class HistoryPresentationModel
63 * @brief This class declares functions which will manage Browser History
65 class HistoryPresentationModel
66 :public PresentationModelBase
70 * @brief The method used to get the already created instance of the HistoryPresentationModel
72 static HistoryPresentationModel* GetInstance(void);
75 * This function deletes all the histories.
77 * @return An error code
80 result ClearHistory(void);
83 * This function creates the list of History
85 * @return An error code
86 * @param nHistoryCount The no of History present
87 * @param historyList An ArrayList where the History will be stored
88 * @param maxCount is used for maximum most visited site else its value is default to -1
89 * @exception E_SUCCESS The method is successful
90 * @exception E_FAILURE The method is not successful as the list is not being created
91 * @remarks To work properly , the history count and and existing list should be passed
93 result CreateHistoryList(int nHistoryCount, Tizen::Base::Collection::ArrayList& historyList, int maxCount = -1);
96 * This function deletes particular history of history ID from the history table
98 * @return An error code
99 * @param historyId The historyId
100 * @exception E_SUCCESS The history is successfully deleted
101 * @exception E_FAILURE The history deletion is unsuccessful
103 result DeleteHistory(int historyId);
106 * This function deletes particular history of history URL.
108 * @return An error code
109 * @param No parameter
111 result DeleteHistory(Tizen::Base::String& historyUrl);
114 * This function deletes Multiple histories from the history table
116 * @return An error code
117 * @param pHistoryIdList The Arraylist of ids of history to be deleted
118 * @exception E_SUCCESS The history is successfully deleted
119 * @exception E_FAILURE The history deletion is unsuccessful
121 result DeleteMultipleHistory(Tizen::Base::Collection::ArrayList* pHistoryIdList);
124 * This function adds the history to the history table
126 * @return An error code
127 * @param history The history
128 * @exception E_SUCCESS The history is inserted successfully to the table
129 * @exception E_FAILURE The history is not inserted successfully
131 result SaveHistory(History& history);
133 result SaveTempHistory(History& history);
136 * This function selects the history from the table
138 * @return An error code
139 * @param startIndex the OFFSET value
140 * @param limit The LIMIT till which the select statement will be executed
141 * @param historyList The arraylist where the selected history will be saved
143 result GetHistory( int startIndex, int limit, Tizen::Base::Collection::ArrayList& historyList);
146 * This function returns the no of history
148 * @return An error code
149 * @param count The no of History present will be saved in count.
151 result GetHistoryCount(int& count);
154 * This function returns the history count from the table on the basis of the time range
156 * @return An error code
157 * @param startTime the startTime
158 * @param endTime the end time
160 result GetHistoryCountWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime, int& count);
163 * This function selects the history from the table within given time range
165 * @return An error code
166 * @param startTime start value of time
167 * @param endTime end value of time
168 * @param startIndex the OFFSET value
169 * @param limit The LIMIT till which the select statement will be executed
170 * @param historyList The arraylist where the selected history will be saved
172 result GetHistoryWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime,int startIndex,int limit, Tizen::Base::Collection::ArrayList& pHistoryList);
175 * This function used to get most visited site in a arraylist
177 * @return An error code
178 * @param historyList The arraylist where the most visited sites will be saved.
180 result GetMostVisitedSites(Tizen::Base::Collection::ArrayList& historyList);
183 * This function returns the no of searched text history
185 * @return An error code
186 * @param count The no of History present will be saved in count.
187 * @param text text entered for search
189 result GetSearchHistoryCount(int& count, Tizen::Base::String& text);
192 * This function selects the searched history from the table
194 * @return An error code
195 * @param startIndex the OFFSET value
196 * @param limit The LIMIT till which the select statement will be executed
197 * @param text text entered for search
198 * @param historyList The arraylist where the selected history will be saved
200 result GetSearchHistory(int startIndex,int limit, Tizen::Base::Collection::ArrayList& historyList, Tizen::Base::String& text);
203 * This function used to given URL count
205 * @return An error code
206 * @param url URL to get its count
207 * @param count count of a URL
209 result GetUrlCount(const Tizen::Base::String& url, int& count);
214 * @brief The Default Constructor
216 HistoryPresentationModel(void);
219 * @brief The Default Destructor
221 ~HistoryPresentationModel(void);
226 HistoryPresentationModel(const HistoryPresentationModel& settingModelObj);
229 * assignment operator
232 HistoryPresentationModel& operator=(const HistoryPresentationModel& settingModelObj);
235 *@brief Initialize storage service
237 result Construct(void);
240 * @brief The method used to create the instance of the SettingsManager class
242 static void CreateInstance(void);
245 * @brief The method used to remove the already created instance of the SettingsManager
247 static void DestroyInstance(void);
250 * This function is used to generate file name
252 * @return filename name of a file
253 * @param No parameter
255 Tizen::Base::String GenerateFileName(void);
257 Tizen::Base::String GetStringFromDate(Tizen::Base::DateTime& date);
259 static HistoryPresentationModel* __pHistoryPresentationModel;
261 Tizen::Base::Collection::ArrayList *__pDataList;
264 #endif //_INT_HISTORY_PRESENTATION_MODEL_H