Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'iphone/Maps/Classes/MWMEditBookmarkController.mm')
-rw-r--r--iphone/Maps/Classes/MWMEditBookmarkController.mm68
1 files changed, 53 insertions, 15 deletions
diff --git a/iphone/Maps/Classes/MWMEditBookmarkController.mm b/iphone/Maps/Classes/MWMEditBookmarkController.mm
index 8ef1de441d..6374b6a2fc 100644
--- a/iphone/Maps/Classes/MWMEditBookmarkController.mm
+++ b/iphone/Maps/Classes/MWMEditBookmarkController.mm
@@ -1,8 +1,10 @@
+#import "Common.h"
#import "MWMBookmarkTitleCell.h"
#import "MWMButtonCell.h"
#import "MWMBookmarkColorViewController.h"
#import "MWMEditBookmarkController.h"
#import "MWMNoteCell.h"
+#import "MWMPlacePageData.h"
#import "MWMPlacePageEntity.h"
#import "MWMPlacePageViewManager.h"
#import "SelectSetVC.h"
@@ -50,13 +52,23 @@ enum RowInMetaInfo
- (void)viewDidLoad
{
[super viewDidLoad];
- NSAssert(self.manager, @"Entity can't be nil!");
- MWMPlacePageEntity * en = self.manager.entity;
- self.cachedDescription = en.bookmarkDescription;
- self.cachedTitle = en.bookmarkTitle;
- self.cachedCategory = en.bookmarkCategory;
- self.cachedColor = en.bookmarkColor;
- m_cachedBac = en.bac;
+ NSAssert(self.manager || self.data, @"Entity and data can't be nil both!");
+ if (isIOS7 || IPAD)
+ {
+ MWMPlacePageEntity * en = self.manager.entity;
+ self.cachedDescription = en.bookmarkDescription;
+ self.cachedTitle = en.bookmarkTitle;
+ self.cachedCategory = en.bookmarkCategory;
+ self.cachedColor = en.bookmarkColor;
+ m_cachedBac = en.bac;
+ }
+ else
+ {
+ self.cachedDescription = self.data.bookmarkDescription;
+ self.cachedTitle = self.data.externalTitle ? self.data.externalTitle : self.data.title;
+ self.cachedCategory = self.data.bookmarkCategory;
+ self.cachedColor = self.data.bookmarkColor;
+ }
[self configNavBar];
[self registerCells];
@@ -95,14 +107,40 @@ enum RowInMetaInfo
- (void)onSave
{
[self.view endEditing:YES];
- MWMPlacePageEntity * en = self.manager.entity;
- en.bookmarkDescription = self.cachedDescription;
- en.bookmarkColor = self.cachedColor;
- en.bookmarkCategory = self.cachedCategory;
- en.bookmarkTitle = self.cachedTitle;
- en.bac = m_cachedBac;
- [en synchronize];
- [self.manager reloadBookmark];
+ if (isIOS7 || IPAD)
+ {
+ MWMPlacePageEntity * en = self.manager.entity;
+ en.bookmarkDescription = self.cachedDescription;
+ en.bookmarkColor = self.cachedColor;
+ en.bookmarkCategory = self.cachedCategory;
+ en.bookmarkTitle = self.cachedTitle;
+ en.bac = m_cachedBac;
+ [en synchronize];
+ [self.manager reloadBookmark];
+ }
+ else
+ {
+ Framework & f = GetFramework();
+ auto const bac = self.data.bac;
+ BookmarkCategory * category = f.GetBmCategory(bac.m_categoryIndex);
+ if (!category)
+ return;
+
+ {
+ BookmarkCategory::Guard guard(*category);
+ Bookmark * bookmark =
+ static_cast<Bookmark *>(guard.m_controller.GetUserMarkForEdit(bac.m_bookmarkIndex));
+ if (!bookmark)
+ return;
+
+ bookmark->SetType(self.cachedColor.UTF8String);
+ bookmark->SetDescription(self.cachedDescription.UTF8String);
+ bookmark->SetName(self.cachedTitle.UTF8String);
+ }
+
+ category->SaveToKMLFile();
+ f.UpdatePlacePageInfoForCurrentSelection();
+ }
[self backTap];
}