From 8d27c3250c7e46be3fb0b01382de5d5739ebf99b Mon Sep 17 00:00:00 2001 From: Arthur-GYT Date: Wed, 8 May 2024 19:07:31 +0200 Subject: [PATCH] [editor] Add website:menu key Signed-off-by: Arthur-GYT --- .../src/main/java/app/organicmaps/editor/EditorFragment.java | 3 +++ android/app/src/main/res/layout/fragment_editor.xml | 4 ++++ data/editor.config | 3 +++ editor/editor_config.cpp | 3 ++- indexer/editable_map_object.cpp | 2 ++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/app/organicmaps/editor/EditorFragment.java b/android/app/src/main/java/app/organicmaps/editor/EditorFragment.java index fed158650b..24026ff007 100644 --- a/android/app/src/main/java/app/organicmaps/editor/EditorFragment.java +++ b/android/app/src/main/java/app/organicmaps/editor/EditorFragment.java @@ -183,6 +183,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe mPhone.setText(Editor.nativeGetPhone()); initMetadataEntry(Metadata.MetadataType.FMD_WEBSITE, R.string.error_enter_correct_web); + initMetadataEntry(Metadata.MetadataType.FMD_WEBSITE_MENU, R.string.error_enter_correct_web); initMetadataEntry(Metadata.MetadataType.FMD_EMAIL, R.string.error_enter_correct_email); initMetadataEntry(Metadata.MetadataType.FMD_CONTACT_FACEBOOK, R.string.error_enter_correct_facebook_page); initMetadataEntry(Metadata.MetadataType.FMD_CONTACT_INSTAGRAM, R.string.error_enter_correct_instagram_page); @@ -427,6 +428,8 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe mPhone.setOnClickListener(this); initBlock(view, Metadata.MetadataType.FMD_WEBSITE, R.id.block_website, R.drawable.ic_website, R.string.website, InputType.TYPE_TEXT_VARIATION_URI); + initBlock(view, Metadata.MetadataType.FMD_WEBSITE_MENU, R.id.block_website_menu, + R.drawable.ic_website_menu, R.string.website_menu, InputType.TYPE_TEXT_VARIATION_URI); initBlock(view, Metadata.MetadataType.FMD_EMAIL, R.id.block_email, R.drawable.ic_email, R.string.email, InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); initBlock(view, Metadata.MetadataType.FMD_CONTACT_FACEBOOK, R.id.block_facebook, diff --git a/android/app/src/main/res/layout/fragment_editor.xml b/android/app/src/main/res/layout/fragment_editor.xml index cc7c8bec74..bd69463653 100644 --- a/android/app/src/main/res/layout/fragment_editor.xml +++ b/android/app/src/main/res/layout/fragment_editor.xml @@ -176,6 +176,10 @@ android:background="?dividerHorizontal"/> + + diff --git a/data/editor.config b/data/editor.config index bd63d58877..7dc14ce47c 100644 --- a/data/editor.config +++ b/data/editor.config @@ -72,6 +72,9 @@ + + + diff --git a/editor/editor_config.cpp b/editor/editor_config.cpp index ff6ffcde89..03194a5547 100644 --- a/editor/editor_config.cpp +++ b/editor/editor_config.cpp @@ -40,7 +40,8 @@ static std::unordered_map const kNamesToFMD = { {"denomination", EType::FMD_DENOMINATION}, {"building:levels", EType::FMD_BUILDING_LEVELS}, {"level", EType::FMD_LEVEL}, - {"drive_through", EType::FMD_DRIVE_THROUGH} + {"drive_through", EType::FMD_DRIVE_THROUGH}, + {"website_menu", EType::FMD_WEBSITE_MENU} /// @todo Add description? }; diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp index 8d35db0d98..fddf8b246d 100644 --- a/indexer/editable_map_object.cpp +++ b/indexer/editable_map_object.cpp @@ -242,6 +242,7 @@ bool EditableMapObject::IsValidMetadata(MetadataID type, std::string const & val switch (type) { case MetadataID::FMD_WEBSITE: return ValidateWebsite(value); + case MetadataID::FMD_WEBSITE_MENU: return ValidateWebsite(value); case MetadataID::FMD_CONTACT_FACEBOOK: return ValidateFacebookPage(value); case MetadataID::FMD_CONTACT_INSTAGRAM: return ValidateInstagramPage(value); case MetadataID::FMD_CONTACT_TWITTER: return ValidateTwitterPage(value); @@ -276,6 +277,7 @@ void EditableMapObject::SetMetadata(MetadataID type, std::string value) switch (type) { case MetadataID::FMD_WEBSITE: value = ValidateAndFormat_website(value); break; + case MetadataID::FMD_WEBSITE_MENU: value = ValidateAndFormat_website(value); break; case MetadataID::FMD_CONTACT_FACEBOOK: value = ValidateAndFormat_facebook(value); break; case MetadataID::FMD_CONTACT_INSTAGRAM: value = ValidateAndFormat_instagram(value); break; case MetadataID::FMD_CONTACT_TWITTER: value = ValidateAndFormat_twitter(value); break;