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.cpp
21 *@brief: Provides functionalities to handle/maintain Browser History.
25 #include "IntHistoryData.h"
26 #include "IntHistoryPresentationModel.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Base::Utility;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Io;
35 using namespace Tizen::Locales;
36 using namespace Tizen::Media;
37 using namespace Tizen::System;
39 extern const wchar_t* HISTORY_DATA_TABLE;
40 extern const wchar_t* BOOKMARK_URL_TABLE;
42 HistoryPresentationModel* HistoryPresentationModel::__pHistoryPresentationModel = null;
44 void HistoryPresentationModel::CreateInstance(void)
46 if (__pHistoryPresentationModel == null)
47 __pHistoryPresentationModel = new(std::nothrow) HistoryPresentationModel();
48 result r = __pHistoryPresentationModel->Construct();
51 delete __pHistoryPresentationModel;
52 __pHistoryPresentationModel = null;
55 std::atexit(DestroyInstance);
59 HistoryPresentationModel* HistoryPresentationModel::GetInstance(void)
61 if (__pHistoryPresentationModel == null)
65 return __pHistoryPresentationModel;
69 void HistoryPresentationModel::DestroyInstance(void)
71 if (__pHistoryPresentationModel)
73 delete __pHistoryPresentationModel;
74 __pHistoryPresentationModel = null;
78 HistoryPresentationModel::HistoryPresentationModel(void)
83 HistoryPresentationModel::~HistoryPresentationModel(void)
88 HistoryPresentationModel::HistoryPresentationModel(const HistoryPresentationModel& historyModelObj)
93 HistoryPresentationModel& HistoryPresentationModel::operator=(const HistoryPresentationModel& historyModelObj)
99 HistoryPresentationModel::Construct(void)
101 result r = E_SUCCESS;
102 r = PresentationModelBase::Initialize();
103 TryCatch( !IsFailed(r),,"Failed to initialize HistoryPresentationModel Model %s",GetErrorMessage(r));
110 HistoryPresentationModel::SaveHistory(History& history)
112 AppLog("HistoryPresentationModel::saveHistory");
113 result r = E_FAILURE;
114 String historyTable(HISTORY_DATA_TABLE);
118 int resultCount = -1;
123 ArrayList* pMostVisitedSites = null;
124 bool isAlreadyExist = false;
125 bool isEligibleForMostVisitedSites = true;
127 String thumbnailPath;
131 SystemTime::GetCurrentTime(todayStart);
132 SystemTime::GetCurrentTime(todayEnd);
133 todayStart.SetValue(todayStart.GetYear(), todayStart.GetMonth(), todayStart.GetDay(), 0,0,0);
134 todayEnd.SetValue(todayStart.GetYear(), todayStart.GetMonth(), todayStart.GetDay(), 23,59,59);
136 ArrayList* pTodaysList = new(std::nothrow) ArrayList();
137 pTodaysList->Construct();
138 GetHistoryCountWithTimeRange(todayStart, todayEnd, todaysCount);
139 GetHistoryWithTimeRange(todayStart, todayEnd, 0, todaysCount, *pTodaysList);
141 for(int count = 0; count < todaysCount; count++)
143 History *pHistoryItem = dynamic_cast<History*>(pTodaysList->GetAt(count));
144 if(pHistoryItem != null && pHistoryItem->GetHistoryUrl().CompareTo(history.GetHistoryUrl()) == 0)
146 history.SetHistoryId(pHistoryItem->GetHistoryId());
151 pMostVisitedSites = new(std::nothrow) ArrayList();
152 pMostVisitedSites->Construct();
153 String historyTitle = history.GetHistoryTitle();
154 historyTitle.Replace(L"'", L"''");
156 String historyUrl = history.GetHistoryUrl();
157 historyUrl.Replace(L"'", L"''");
159 PresentationModelBase::GetCurrentDateTime(date);
160 GetMostVisitedSites(*pMostVisitedSites);
161 GetUrlCount(historyUrl, urlCount);
162 for (i = 0; i < pMostVisitedSites->GetCount(); i++)
164 History* pHistory = static_cast< History* >(pMostVisitedSites->GetAt(i));
165 if (pHistory != null && pHistory->GetHistoryUrl().CompareTo(historyUrl) == 0)
167 isAlreadyExist = true;
170 if ( pHistory != null && urlCount >= pHistory->GetVisitedCount())
172 isEligibleForMostVisitedSites = true;
176 isEligibleForMostVisitedSites = false;
180 if (pMostVisitedSites->GetCount() < 9 || (isAlreadyExist == false && isEligibleForMostVisitedSites == true && history.GetThumbnail() != null))
182 AppLog("HistoryPresentationModel::SaveHistory coming here");
184 thumbnailPath = GenerateFileName();
185 AppLog("generating file path and url %ls, %ls",thumbnailPath.GetPointer(),historyUrl.GetPointer());
186 Image* pImage = new(std::nothrow) Image();
188 result r = pImage->EncodeToFile(*history.GetThumbnail(), IMG_FORMAT_JPG, thumbnailPath, true);
192 AppLogDebug("PresentationModelBase::saveHistory -(%s)\n", GetErrorMessage(r));
196 delete pMostVisitedSites;
197 pMostVisitedSites = NULL ;
199 if (history.GetHistoryId() == "")
201 columnNames.Append(L"TITLE, ");
202 columnNames.Append(L"URL, ");
203 columnNames.Append(L"VISITED_TIME, ");
204 columnNames.Append(L"ICON_PATH, ");
205 columnNames.Append(L"FAVICON_ID, ");
206 columnNames.Append(L"THUMBNAIL_PATH");
208 query.Append(L"INSERT INTO ");
209 query.Append(historyTable);
211 query.Append(columnNames);
213 query.Append("VALUES(");
215 query.Append(historyTitle);
219 query.Append(historyUrl);
221 query.Append("DateTime(");
223 query.Append(GetStringFromDate(date));
224 query.Append("'), ");
226 query.Append(history.GetHistoryIconPath());
230 query.Append(history.GetFaviconId());
234 query.Append(thumbnailPath);
240 query.Append(L"UPDATE ");
241 query.Append(historyTable);
242 query.Append(" SET TITLE = ");
244 query.Append(historyTitle);
246 query.Append(", URL = ");
248 query.Append(historyUrl);
250 query.Append(", VISITED_TIME = ");
251 query.Append("DateTime(");
253 query.Append(GetStringFromDate(date));
255 query.Append(", ICON_PATH = ");
257 query.Append(history.GetHistoryIconPath());
261 query.Append(history.GetFaviconId());
265 query.Append(thumbnailPath);
267 query.Append(" WHERE ID = ");
268 query.Append(history.GetHistoryId());
271 r = PresentationModelBase::ExecuteQuery(query, resultCount);
272 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveHistory query failed %s",GetErrorMessage(r));
274 r = PresentationModelBase::CommitDb();
276 r = GetLastInsertedId(historyTable, rowId);
279 AppLogDebug("PresentationModelBase::saveHistory -(%s)\n", GetErrorMessage(r));
285 historyId.Append(rowId);
286 if (historyId.GetLength() < 0)
290 //Set the generated ID to History
291 history.SetHistoryId(historyId);
296 HistoryPresentationModel::DeleteMultipleHistory(ArrayList* pHistoryIdList)
298 result r = E_FAILURE;
300 String historyTable = HISTORY_DATA_TABLE;
301 int resultCount = -1;
303 if (pHistoryIdList == null)
308 query.Append(L"DELETE FROM ");
309 query.Append(historyTable);
310 query.Append(" WHERE");
311 for(int index = 0; index <= pHistoryIdList->GetCount()-2; index++)
313 query.Append(" ID = ");
314 String* hisId = static_cast<String*>(pHistoryIdList->GetAt(index));
315 query.Append(*hisId);
316 query.Append(" OR ");
318 query.Append(" ID = ");
319 String* hisId = static_cast<String*>(pHistoryIdList->GetAt(pHistoryIdList->GetCount()-1));
324 query.Append(*hisId);
326 r = PresentationModelBase::ExecuteQuery(query, resultCount);
327 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r));
329 r = PresentationModelBase::CommitDb();
335 HistoryPresentationModel::DeleteHistory(const int historyId)
337 result r = E_FAILURE;
339 String historyTable = HISTORY_DATA_TABLE;
340 int resultCount = -1;
344 return E_INVALID_ARG;
347 query.Append(L"DELETE FROM ");
348 query.Append(historyTable);
349 query.Append(" WHERE ID = ");
350 query.Append(historyId);
352 r = PresentationModelBase::ExecuteQuery(query, resultCount);
353 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r));
355 r = PresentationModelBase::CommitDb();
361 HistoryPresentationModel::DeleteHistory(String& historyUrl)
363 result r = E_FAILURE;
365 String historyTable = HISTORY_DATA_TABLE;
366 int resultCount = -1;
368 query.Append(L"DELETE FROM ");
369 query.Append(historyTable);
370 query.Append(" WHERE URL = '");
371 query.Append(historyUrl);
374 r = PresentationModelBase::ExecuteQuery(query, resultCount);
375 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r));
377 r = PresentationModelBase::CommitDb();
383 HistoryPresentationModel::ClearHistory(void)
385 result r = E_FAILURE;
387 String historyTable = HISTORY_DATA_TABLE;
388 int resultCount = -1;
390 query.Append(L"DELETE FROM ");
391 query.Append(historyTable);
393 r = PresentationModelBase::ExecuteQuery(query, resultCount);
394 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::ClearHistory GetLastInsertedId failed %s",GetErrorMessage(r));
396 r = PresentationModelBase::CommitDb();
402 HistoryPresentationModel::GetHistoryCount(int& historyCount)
407 String historyTable(HISTORY_DATA_TABLE);
408 result r = E_FAILURE;
409 bool nextRowPresent = false;
411 query.Append(L"SELECT COUNT(ID) FROM ");
412 query.Append(historyTable);
414 r = PresentationModelBase::ExecuteQuery(query, count);
415 AppLog("the count is %d", count);
416 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCount query failed %s",GetErrorMessage(r));
418 r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent);
419 if (IsFailed(r) != null)
421 if (nextRowPresent == true)
423 r = PresentationModelBase::GetColumn(0, intVal);
424 if (IsFailed(r) != null)
426 AppLogDebug("Error:PresentationModelBase::GetColumn:%s", GetErrorMessage(r));
430 historyCount = intVal;
436 HistoryPresentationModel::GetHistoryCountWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime, int& historyCount)
442 String historyTable(HISTORY_DATA_TABLE);
443 result r = E_FAILURE;
444 bool nextRowPresent = false;
446 query.Append(L"SELECT COUNT(ID) FROM ");
447 query.Append(historyTable);
448 query.Append(" WHERE VISITED_TIME >= ");
449 query.Append("DateTime(");
451 query.Append(GetStringFromDate(startTime));
453 query.Append(" AND VISITED_TIME <= ");
454 query.Append("DateTime(");
456 query.Append(GetStringFromDate(endTime));
459 r = PresentationModelBase::ExecuteQuery(query, count);
460 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCountWithTimeRange query failed %s",GetErrorMessage(r));
462 r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent);
465 if (nextRowPresent == true)
467 r = PresentationModelBase::GetColumn(0, intVal);
470 AppLogDebug("Error:PresentationModelBase::DbGetColumn:%s", GetErrorMessage(r));
474 historyCount = intVal;
480 HistoryPresentationModel::GetHistory(const int startIndex,const int limit, ArrayList& pHistoryList)
485 String historyTable(HISTORY_DATA_TABLE);
486 result r = E_FAILURE;
488 query.Append(L"SELECT");
489 query.Append(historyTable);
490 query.Append(L".*, ");
491 query.Append(BOOKMARK_URL_TABLE);
492 query.Append(L".ID ");
493 query.Append(L"FROM ");
494 query.Append(historyTable);
496 query.Append(BOOKMARK_URL_TABLE);
497 query.Append(L" WHERE ");
498 query.Append(historyTable);
499 query.Append(L".URL ");
502 query.Append(L"SELECT");
503 query.Append(historyTable);
504 query.Append(L".URL ");
505 query.Append(L"FROM ");
506 query.Append(BOOKMARK_URL_TABLE);
507 query.Append(L" LEFT JOIN ");
508 query.Append(historyTable);
510 query.Append(BOOKMARK_URL_TABLE);
511 query.Append(L".URL = ");
512 query.Append(historyTable);
513 query.Append(L".URL ");
514 query.Append(" ORDER BY");
515 query.Append(historyTable);
516 query.Append(L".VISITED_TIME DESC");
518 query.Append(" GROUP BY ");
519 query.Append(historyTable);
520 query.Append(L".URL ");
521 query.Append(" ORDER BY");
522 query.Append(L"COUNT(");
523 query.Append(historyTable);
524 query.Append(L".URL) DESC ");
530 query.Append(" LIMIT ");
536 query.Append(" OFFSET ");
537 query.Append(startIndex);
541 r = PresentationModelBase::ExecuteQuery(query, count);
542 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistory query failed %s",GetErrorMessage(r));
544 r = CreateHistoryList(count, pHistoryList);
547 AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
553 HistoryPresentationModel::CreateHistoryList(int historyCount, ArrayList& historyList, int maxCount)
556 History* pHistory = null;
560 result r = E_FAILURE;
565 DateTime visitedTime;
567 String thumbnailPath;
568 bool nextRowPresent = false;
570 Bitmap* pThumnailBitmap = null;
573 if (historyCount < 1)
578 for (int Count = 0; (maxCount == -1 && Count < historyCount ) || (maxCount != -1 && Count < maxCount && Count < historyCount); Count++)
580 r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent);
585 if (nextRowPresent == true)
587 pHistory = new(std::nothrow) History;
590 for (int columnCount = 0; columnCount < MAX_NOTE_TABLE_COLUMN; columnCount++)
596 r = PresentationModelBase::GetColumn(columnCount, intVal);
602 historyId.Append(intVal);
603 if (historyId.GetLength() > 0)
605 pHistory->SetHistoryId(historyId);
613 r = PresentationModelBase::GetColumn(columnCount, stringVal);
616 pHistory->SetHistoryTitle(stringVal);
621 r = PresentationModelBase::GetColumn(columnCount, stringVal);
624 pHistory->SetHistoryUrl(stringVal);
628 case HISTORY_VISITED_TIME:
629 r = PresentationModelBase::GetColumn(columnCount, dateVal);
632 visitedTime = dateVal;
633 pHistory->SetVisitedTime(visitedTime);
637 case HISTORY_ICON_PATH:
638 r = PresentationModelBase::GetColumn(columnCount, stringVal);
641 iconPath = stringVal;
642 pHistory->SetIconPath(iconPath);
646 case HISTORY_FAVICONID:
648 r = PresentationModelBase::GetColumn(columnCount, intVal);
654 faviconId.Append(intVal);
655 if (faviconId.GetLength() > 0)
657 pHistory->SetFaviconId(faviconId);
662 case HISTORY_THUMBNAIL:
663 r = PresentationModelBase::GetColumn(columnCount, stringVal);
667 thumbnailPath = stringVal;
668 pThumnailBitmap = image.DecodeN(thumbnailPath, BITMAP_PIXEL_FORMAT_RGB565);
669 if (pThumnailBitmap != null)
671 pHistory->SetThumbnail(pThumnailBitmap);
672 pHistory->SetThumbnailPath(thumbnailPath);
676 case HISTORY_BOOKMARK_ID:
677 r = PresentationModelBase::GetColumn(columnCount, intVal);
683 bookmarkId.Append(intVal);
684 if (bookmarkId.GetLength() > 0)
686 pHistory->SetBookmarkId(bookmarkId);
692 case HISTORY_VISITED_COUNT:
693 r = PresentationModelBase::GetColumn(columnCount, intVal);
698 pHistory->SetVisitedCount(intVal);
710 r = historyList.Add(*pHistory);
724 HistoryPresentationModel::GetSearchHistory(const int startIndex,const int limit, ArrayList& pHistoryList, String& text)
726 text.Replace(L"'", L"''");
730 String historyTable(HISTORY_DATA_TABLE);
731 result r = E_FAILURE;
733 query.Append(L"SELECT ");
734 query.Append(historyTable);
735 query.Append(L".*, ");
736 query.Append(BOOKMARK_URL_TABLE);
737 query.Append(L".ID ");
738 query.Append(L"FROM ");
739 query.Append(historyTable);
740 query.Append(L" LEFT JOIN ");
741 query.Append(BOOKMARK_URL_TABLE);
742 query.Append(L" ON ");
743 query.Append(BOOKMARK_URL_TABLE);
744 query.Append(L".URL = ");
745 query.Append(historyTable);
746 query.Append(L".URL ");
747 query.Append(L" WHERE (");
748 query.Append(historyTable);
749 query.Append(L".TITLE LIKE '%");
752 query.Append(" OR ");
754 query.Append(historyTable);
755 query.Append(L".URL LIKE '%");
758 query.Append(" ORDER BY VISITED_TIME DESC");
763 query.Append(" LIMIT ");
769 query.Append(" OFFSET ");
770 query.Append(startIndex);
774 r = HistoryPresentationModel::ExecuteQuery(query, count);
775 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistory query failed %s",GetErrorMessage(r));
777 r = CreateHistoryList(count, pHistoryList);
780 AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
786 HistoryPresentationModel::GetSearchHistoryCount(int& historyCount, String& text)
791 String historyTable(HISTORY_DATA_TABLE);
792 result r = E_FAILURE;
793 bool nextRowPresent = false;
795 text.Replace(L"'", L"''");
796 query.Append(L"SELECT COUNT(ID) FROM ");
797 query.Append(historyTable);
798 query.Append(L" WHERE (TITLE LIKE '%");
801 query.Append(" OR ");
802 query.Append(L"(URL LIKE '%");
806 r = HistoryPresentationModel::ExecuteQuery(query, count);
807 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistoryCount query failed %s",GetErrorMessage(r));
809 r = HistoryPresentationModel::DbIsNextRowPresent(nextRowPresent);
810 if (IsFailed(r) != null)
812 if (nextRowPresent == true)
814 r = HistoryPresentationModel::GetColumn(0, intVal);
815 if (IsFailed(r) != null)
817 AppLogDebug("Error:HistoryPresentationModel::DbGetColumn:%s", GetErrorMessage(r));
821 historyCount = intVal;
827 HistoryPresentationModel::GetHistoryWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime,const int startIndex,const int limit, ArrayList& pHistoryList)
831 String historyTable(HISTORY_DATA_TABLE);
832 result r = E_FAILURE;
834 query.Append(L"SELECT ");
835 query.Append(historyTable);
836 query.Append(L".*, ");
837 query.Append(BOOKMARK_URL_TABLE);
838 query.Append(L".ID ");
839 query.Append(L"FROM ");
840 query.Append(historyTable);
841 query.Append(L" LEFT JOIN ");
842 query.Append(BOOKMARK_URL_TABLE);
843 query.Append(L" ON ");
844 query.Append(BOOKMARK_URL_TABLE);
845 query.Append(L".URL = ");
846 query.Append(historyTable);
847 query.Append(L".URL ");
848 query.Append(" WHERE ");
849 query.Append(historyTable);
850 query.Append(L".VISITED_TIME >= ");
851 query.Append("DateTime(");
853 query.Append(GetStringFromDate(startTime));
855 query.Append(" AND ");
856 query.Append(historyTable);
857 query.Append(L".VISITED_TIME <= ");
858 query.Append("DateTime(");
860 query.Append(GetStringFromDate(endTime));
862 query.Append(" ORDER BY VISITED_TIME DESC");
867 query.Append(" LIMIT ");
873 query.Append(" OFFSET ");
874 query.Append(startIndex);
878 r = HistoryPresentationModel::ExecuteQuery(query, count);
879 AppLog("the count is %d",count);
880 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryWithTimeRange query failed %s",GetErrorMessage(r));
882 r = CreateHistoryList(count, pHistoryList);
885 AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
892 HistoryPresentationModel::GetMostVisitedSites(ArrayList& pHistoryList)
897 String historyTable(HISTORY_DATA_TABLE);
898 result r = E_FAILURE;
901 //query = L"SELECT *, COUNT(URL) AS NOS FROM HistoryData GROUP BY URL ORDER BY NOS DESC";
902 query = L"SELECT HistoryData.*, Bookmark.ID, COUNT(HistoryData.URL) AS NOS FROM HistoryData LEFT JOIN Bookmark ON Bookmark.URL = HistoryData.URL WHERE HistoryData.URL != '' GROUP BY HistoryData.URL ORDER BY NOS DESC";
904 r = HistoryPresentationModel::ExecuteQuery(query, count);
905 AppLog("the count is %d",count);
906 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryWithTimeRange query failed %s",GetErrorMessage(r));
908 r = CreateHistoryList(count, pHistoryList, 9);
911 AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r));
918 HistoryPresentationModel::GetUrlCount(const String& Url, int& historyCount)
923 String historyTable(HISTORY_DATA_TABLE);
924 result r = E_FAILURE;
925 bool nextRowPresent = false;
927 query.Append(L"SELECT COUNT(URL) FROM ");
928 query.Append(historyTable);
929 query.Append(L" WHERE URL = ");
934 r = PresentationModelBase::ExecuteQuery(query, count);
935 AppLog("the count is %d", count);
936 TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCount query failed %s",GetErrorMessage(r));
938 r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent);
941 if (nextRowPresent == true)
943 r = PresentationModelBase::GetColumn(0, intVal);
946 AppLogDebug("Error:PresentationModelBase::GetColumn:%s", GetErrorMessage(r));
950 historyCount = intVal;
956 HistoryPresentationModel::GenerateFileName(void)
958 AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry();
959 if ( pAppRegistry == NULL )
963 String keyCount("ThumbnailCount");
964 String fileName = UiApp::GetInstance()->GetAppRootPath() + "/data/Thumbnail/thumbnails";
965 result r = E_SUCCESS;
967 r = pAppRegistry->Get(keyCount, keyValue);
969 if (r == E_KEY_NOT_FOUND)
972 pAppRegistry->Add(keyCount, keyValue);
977 pAppRegistry->Set(keyCount, keyValue);
980 fileName.Append(keyValue);
981 fileName.Append(".jpg");
982 pAppRegistry->Save();
988 HistoryPresentationModel::GetStringFromDate(DateTime& date)
990 String dateFormat = L"";
991 dateFormat.Append(date.GetYear());
992 dateFormat.Append('-');
993 if(date.GetMonth() < 10)
995 dateFormat.Append('0');
997 dateFormat.Append(date.GetMonth());
998 dateFormat.Append('-');
999 if(date.GetDay() < 10)
1001 dateFormat.Append('0');
1003 dateFormat.Append(date.GetDay());
1004 dateFormat.Append(' ');
1005 if(date.GetHour() < 10)
1007 dateFormat.Append('0');
1009 dateFormat.Append(date.GetHour());
1010 dateFormat.Append(':');
1011 if(date.GetMinute() < 10)
1013 dateFormat.Append('0');
1015 dateFormat.Append(date.GetMinute());
1016 dateFormat.Append(':');
1017 if(date.GetSecond() < 10)
1019 dateFormat.Append('0');
1021 dateFormat.Append(date.GetSecond());