[bookmarks] Supporting of bookmarks sorting for categories from catalog.

This commit is contained in:
Daria Volvenkova 2019-08-30 17:47:45 +03:00 committed by Aleksey Belousov
parent 276f0529f6
commit fbce7107c2

View file

@ -1039,7 +1039,8 @@ void BookmarkManager::SetBookmarksAddresses(AddressesCollection const & addresse
auto session = GetEditSession();
for (auto const & item : addresses)
{
auto bm = session.GetBookmarkForEdit(item.first);
// Use inner method GetBookmarkForEdit to save address even if the bookmarks is not editable.
auto bm = GetBookmarkForEdit(item.first);
bm->SetAddress(item.second);
}
}
@ -1332,7 +1333,8 @@ void BookmarkManager::GetSortedCategory(SortParams const & params)
return;
}
AddressesCollection newAddresses;
PrepareBookmarksAddresses(bookmarksForSort, newAddresses);
if (params.m_sortingType == SortingType::ByDistance)
PrepareBookmarksAddresses(bookmarksForSort, newAddresses);
SortedBlocksCollection sortedBlocks;
GetSortedCategoryImpl(params, bookmarksForSort, tracksForSort, sortedBlocks);
@ -1356,7 +1358,8 @@ void BookmarkManager::GetSortedCategory(SortParams const & params)
}
AddressesCollection newAddresses;
PrepareBookmarksAddresses(bookmarksForSort, newAddresses);
if (params.m_sortingType == SortingType::ByDistance)
PrepareBookmarksAddresses(bookmarksForSort, newAddresses);
SortedBlocksCollection sortedBlocks;
GetSortedCategoryImpl(params, bookmarksForSort, tracksForSort, sortedBlocks);
@ -1618,6 +1621,9 @@ void BookmarkManager::LoadState()
std::string BookmarkManager::GetMetadataEntryName(kml::MarkGroupId groupId) const
{
CHECK(IsBookmarkCategory(groupId), ());
if (IsCategoryFromCatalog(groupId))
return GetBmCategory(groupId)->GetServerId();
return GetCategoryFileName(groupId);
}