Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntHistoryPresentationModel.cpp
index 07d7f58..cabc82f 100644 (file)
@@ -70,6 +70,7 @@ void HistoryPresentationModel::DestroyInstance(void)
 {
        if (__pHistoryPresentationModel)
        {
+               __pHistoryPresentationModel->UnInitialize();
                delete __pHistoryPresentationModel;
                __pHistoryPresentationModel = null;
        }
@@ -337,6 +338,7 @@ void HistoryPresentationModel::UpdateHistoryFavIcon(History& history, Tizen::Gra
        // added because conversion may fail
        if(GetLastResult() != E_SUCCESS)
                return;
+       delete pFavBuffer;
        history.SetFavIconBitmap(favIconImage);
 
        delete pImage;
@@ -412,6 +414,12 @@ HistoryPresentationModel::SaveTempHistory(History& history)
                }
        }
 
+       if (pTodaysList)
+       {
+               pTodaysList->RemoveAll();
+               delete pTodaysList;
+       }
+
        pMostVisitedSites = new(std::nothrow) ArrayList();
        pMostVisitedSites->Construct();
        String historyTitle = history.GetHistoryTitle();
@@ -879,7 +887,7 @@ HistoryPresentationModel::CreateHistoryList(int historyCount, ArrayList& history
                                        {
                                                pFavIconBuffer = new ByteBuffer();
                                                r = PresentationModelBase::GetColumn(columnCount, *pFavIconBuffer);
-                                               if (!IsFailed(r))
+                                               if (!IsFailed(r) && pFavIconBuffer->GetCapacity() > 0)
                                                {
                                                        pHistory->SetFavIconBuffer(*pFavIconBuffer);
                                                }
@@ -967,13 +975,13 @@ HistoryPresentationModel::GetSearchHistory(const int startIndex,const int limit,
        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");
 
 
@@ -1031,13 +1039,13 @@ HistoryPresentationModel::GetSearchHistoryCount(int& historyCount, String& text)
        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");
 
        r = HistoryPresentationModel::ExecuteQuery(query, count);