Minor code style fixes.

This commit is contained in:
vng 2013-03-23 20:08:20 +03:00 committed by Alex Zolotarev
parent 6788854710
commit dde0d34deb
3 changed files with 16 additions and 14 deletions

View file

@ -55,9 +55,6 @@ void BookmarkManager::ClearBookmarks()
void BookmarkManager::LoadBookmarks()
{
if (!GetPlatform().IsPro())
return;
ClearBookmarks();
string const dir = GetPlatform().WritableDir();
@ -82,13 +79,17 @@ size_t BookmarkManager::AddBookmark(size_t categoryIndex, Bookmark & bm)
{
bm.SetTimeStamp(time(0));
bm.SetScale(scales::GetScaleLevelD(m_framework.GetNavigator().Screen().GlobalRect().GetLocalRect()));
m_categories[categoryIndex]->AddBookmark(bm);
if (m_categories[categoryIndex]->GetFileName().empty())
{
BookmarkCategory * pCat = m_categories[categoryIndex];
pCat->AddBookmark(bm);
// Immediately do save category for the new one
// (we need it for the last used category ID).
if (pCat->GetFileName().empty())
m_categories[categoryIndex]->SaveToKMLFile();
}
m_lastCategoryUrl = m_categories[categoryIndex]->GetFileName();
return m_categories[categoryIndex]->GetBookmarksCount() - 1;
m_lastCategoryUrl = pCat->GetFileName();
return pCat->GetBookmarksCount() - 1;
}
size_t BookmarkManager::LastEditedBMCategory()

View file

@ -374,10 +374,11 @@ void Framework::LoadBookmarks()
{
if (!GetPlatform().IsPro())
return;
m_bmManager.LoadBookmarks();
}
size_t Framework::AddBookmark(size_t const & categoryIndex, Bookmark & bm)
size_t Framework::AddBookmark(size_t categoryIndex, Bookmark & bm)
{
return m_bmManager.AddBookmark(categoryIndex, bm);
}
@ -437,7 +438,6 @@ BookmarkAndCategory Framework::GetBookmark(m2::PointD const & pxPoint, double vi
{
for (int i = 0; i < m_bmManager.AdditionalLayerNumberOfPoi(); ++i)
{
m2::PointD const pt = m_bmManager.AdditionalPoiLayerGetBookmark(i)->GetOrg();
if (rect.IsPointInside(pt))
{
@ -454,9 +454,10 @@ BookmarkAndCategory Framework::GetBookmark(m2::PointD const & pxPoint, double vi
for (size_t i = 0; i < m_bmManager.GetBmCategoriesCount(); ++i)
{
bool currentCategoryIsVisible = m_bmManager.GetBmCategory(i)->IsVisible();
bool const currentCategoryIsVisible = m_bmManager.GetBmCategory(i)->IsVisible();
if (!currentCategoryIsVisible && returnBookmarkIsVisible)
continue;
size_t const count = m_bmManager.GetBmCategory(i)->GetBookmarksCount();
for (size_t j = 0; j < count; ++j)
{

View file

@ -169,11 +169,11 @@ public:
/// @name Always returns existing or newly created bookmark category.
//@{
size_t AddBookmark(size_t const & categoryIndex, Bookmark & bm);
size_t AddBookmark(size_t categoryIndex, Bookmark & bm);
//@}
size_t AddCategory(string const & categoryName);
inline size_t GetBmCategoriesCount() const { return m_bmManager.GetBmCategoriesCount();}
inline size_t GetBmCategoriesCount() const { return m_bmManager.GetBmCategoriesCount(); }
/// @returns 0 if category is not found
BookmarkCategory * GetBmCategory(size_t index) const;