{
if (__pHistoryPresentationModel)
{
+ __pHistoryPresentationModel->UnInitialize();
delete __pHistoryPresentationModel;
__pHistoryPresentationModel = null;
}
pImage = new Image();
pImage->Construct();
- int __favIconWidth = favIconImage.GetWidth();
- int __favIconHeight = favIconImage.GetHeight();
-
Tizen::Base::ByteBuffer* pFavBuffer = pImage->EncodeToBufferN(favIconImage, IMG_FORMAT_PNG);
-
- history.SetFavIconBuffer(*pFavBuffer);
+ // added because conversion may fail
+ if(GetLastResult() != E_SUCCESS)
+ return;
+ delete pFavBuffer;
+ history.SetFavIconBitmap(favIconImage);
delete pImage;
}
}
+ if (pTodaysList)
+ {
+ pTodaysList->RemoveAll();
+ delete pTodaysList;
+ }
+
pMostVisitedSites = new(std::nothrow) ArrayList();
pMostVisitedSites->Construct();
String historyTitle = history.GetHistoryTitle();
r = GetHistory(0, count, *__pDataList);
if (IsFailed(r))
{
+ delete __pDataList;
+ __pDataList = null;
return r;
}
}
for (int counter = 0 ; counter < count; counter++)
{
History *pHistory = dynamic_cast<History*>(__pDataList->GetAt(counter));
+ AppLog("vinayhistorytimecomparison %d, %d",pHistory->GetVisitedTime().CompareTo(startTime),pHistory->GetVisitedTime().CompareTo(endTime));
if(pHistory != null && pHistory->GetVisitedTime().CompareTo(startTime) > 0 && pHistory->GetVisitedTime().CompareTo(endTime) < 0)
{
historyCount++;
{
pFavIconBuffer = new ByteBuffer();
r = PresentationModelBase::GetColumn(columnCount, *pFavIconBuffer);
- if (!IsFailed(r))
+ if (!IsFailed(r) && pFavIconBuffer->GetCapacity() > 0)
{
pHistory->SetFavIconBuffer(*pFavIconBuffer);
}
result
HistoryPresentationModel::GetSearchHistory(const int startIndex,const int limit, ArrayList& pHistoryList, String& text)
{
+ DateTime endTime;
+ SystemTime::GetCurrentTime(endTime);
+
text.Replace(L"'", L"''");
int count = -1;
query.Append(historyTable);
query.Append(L".TITLE LIKE '%");
query.Append(text);
- query.Append("%')");
+ query.Append("%' ESCAPE '/')");
query.Append(" OR ");
query.Append(L"(");
query.Append(historyTable);
query.Append(L".ADDRESS LIKE '%");
query.Append(text);
- query.Append("%')");
+ query.Append("%' ESCAPE '/')");
query.Append(" ORDER BY VISITDATE DESC");
- //Append LIMIT
- if (limit > 0)
- {
- query.Append(" LIMIT ");
- query.Append(limit);
- //Append OFFESET
- if (startIndex >= 0)
+ r = HistoryPresentationModel::ExecuteQuery(query, count);
+// TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistory query failed %s",GetErrorMessage(r));
+
+ ArrayList pAllSearchList;
+
+ r = CreateHistoryList(count, pAllSearchList);
+
+ int itemsFoundIndex = -1;
+ for (int counter = 0 ; counter < count; counter++)
+ {
+ History *pHistory = dynamic_cast<History*>(pAllSearchList.GetAt(counter));
+ if(pHistory != null && pHistory->GetVisitedTime().CompareTo(endTime) < 0)
{
- query.Append(" OFFSET ");
- query.Append(startIndex);
+ itemsFoundIndex++;
+ if(itemsFoundIndex >= startIndex && itemsFoundIndex < (limit + startIndex))
+ {
+ pHistoryList.Add(*pHistory);
+ }
+ else if(itemsFoundIndex > (limit + startIndex))
+ {
+ break;
+ }
}
}
- r = HistoryPresentationModel::ExecuteQuery(query, count);
- TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistory query failed %s",GetErrorMessage(r));
- r = CreateHistoryList(count, pHistoryList);
if (IsFailed(r))
{
AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
result
HistoryPresentationModel::GetSearchHistoryCount(int& historyCount, String& text)
{
+ DateTime endTime;
+ SystemTime::GetCurrentTime(endTime);
+ text.Replace(L"'", L"''");
+
int count = -1;
- int intVal = -1;
String query;
String historyTable(HISTORY_DATA_TABLE);
result r = E_FAILURE;
- bool nextRowPresent = false;
- text.Replace(L"'", L"''");
- query.Append(L"SELECT COUNT(ID) FROM ");
+ query.Append(L"SELECT ");
query.Append(historyTable);
- query.Append(L" WHERE (TITLE LIKE '%");
+ query.Append(L".* ");
+ query.Append(L"FROM ");
+ query.Append(historyTable);
+ query.Append(L" WHERE (");
+ query.Append(historyTable);
+ query.Append(L".TITLE LIKE '%");
query.Append(text);
- query.Append("%')");
+ query.Append("%'ESCAPE '/')");
query.Append(" OR ");
- query.Append(L"(ADDRESS LIKE '%");
+ query.Append(L"(");
+ query.Append(historyTable);
+ query.Append(L".ADDRESS LIKE '%");
query.Append(text);
- query.Append("%')");
+ query.Append("%' ESCAPE '/')");
+ query.Append(" ORDER BY VISITDATE DESC");
r = HistoryPresentationModel::ExecuteQuery(query, count);
- TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistoryCount query failed %s",GetErrorMessage(r));
+// TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistory query failed %s",GetErrorMessage(r));
- r = HistoryPresentationModel::DbIsNextRowPresent(nextRowPresent);
- if (IsFailed(r) != null)
- return r;
- if (nextRowPresent == true)
+ ArrayList pAllSearchList;
+
+ r = CreateHistoryList(count, pAllSearchList);
+
+ historyCount = 0;
+ for (int counter = 0 ; counter < count; counter++)
{
- r = HistoryPresentationModel::GetColumn(0, intVal);
- if (IsFailed(r) != null)
+ History *pHistory = dynamic_cast<History*>(pAllSearchList.GetAt(counter));
+ if(pHistory != null && pHistory->GetVisitedTime().CompareTo(endTime) < 0)
{
- AppLogDebug("Error:HistoryPresentationModel::DbGetColumn:%s", GetErrorMessage(r));
- return r;
+ historyCount++;
}
}
- historyCount = intVal;
+
+ if (IsFailed(r))
+ {
+ AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
+ }
CATCH: return r;
}
r = GetHistory(0, count, *__pDataList);
if(IsFailed(r))
{
+ delete __pDataList;
+ __pDataList = null;
return r;
}
}