| 2635 | } |
| 2636 | |
| 2637 | kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(kml::CategoryData && data, bool autoSave /* = true */) |
| 2638 | { |
| 2639 | CHECK_THREAD_CHECKER(m_threadChecker, ()); |
| 2640 | |
| 2641 | // _group id_ is not persistant and assigned every time on loading from file. |
| 2642 | /// @todo Is there any reason to keep and update kLastBookmarkCategoryId in SecureStorage (settings). |
| 2643 | if (data.m_id == kml::kInvalidMarkGroupId) |
| 2644 | data.m_id = UserMarkIdStorage::Instance().GetNextCategoryId(); |
| 2645 | auto groupId = data.m_id; |
| 2646 | |
| 2647 | CHECK_EQUAL(m_categories.count(groupId), 0, ()); |
| 2648 | CHECK_EQUAL(m_compilations.count(groupId), 0, ()); |
| 2649 | m_categories.emplace(groupId, std::make_unique<BookmarkCategory>(std::move(data), autoSave)); |
| 2650 | UpdateBmGroupIdList(); |
| 2651 | m_changesTracker.OnAddGroup(groupId); |
| 2652 | return groupId; |
| 2653 | } |
| 2654 | |
| 2655 | kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(std::string const & name, bool autoSave) |
| 2656 | { |