diff options
author | Gaurav Dhingra <gauravdhingra.gxyd@gmail.com> | 2016-12-14 11:56:20 +0530 |
---|---|---|
committer | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-12-19 18:22:50 +0000 |
commit | 9fa5439cb6aa695ca2e3fefd4426bdd150091cbe (patch) | |
tree | 7d5aba5d4731d6bd08e5dae2022aa9fe640fa9cf /sfx2/source/control/emojiview.cxx | |
parent | 8d31d285445aa103289fc1a65ec0ecd8ff606bec (diff) |
tdf#104622 Add duplicate node entry to elements in emoji.json database
Add boolean field "duplicate": true
Change-Id: I8e45ed4694bfc75b18c2405146e5eaa142559c1b
Reviewed-on: https://gerrit.libreoffice.org/31997
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com>
Diffstat (limited to 'sfx2/source/control/emojiview.cxx')
-rw-r--r-- | sfx2/source/control/emojiview.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/sfx2/source/control/emojiview.cxx b/sfx2/source/control/emojiview.cxx index 36b185cf9a1b..ee4eefb04d50 100644 --- a/sfx2/source/control/emojiview.cxx +++ b/sfx2/source/control/emojiview.cxx @@ -68,7 +68,7 @@ bool ViewFilter_Category::operator () (const ThumbnailViewItem *pItem) EmojiView::EmojiView (vcl::Window *pParent) : ThumbnailView(pParent, WB_TABSTOP | WB_VSCROLL) { - //locate json data file + // locate json data file OUString sPath("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/emojiconfig/emoji.json"); rtl::Bootstrap::expandMacros(sPath); std::string strPath = OUStringToOString(sPath.copy(strlen("file://")), RTL_TEXTENCODING_UTF8).getStr(); @@ -103,10 +103,10 @@ void EmojiView::Populate() return; } - //TODO::populate view using the orcus json parser + // TODO::populate view using the orcus json parser using node = orcus::json_document_tree::node; - //default json config + // default json config orcus::json_config config; orcus::json_document_tree aEmojiInfo; @@ -124,16 +124,17 @@ void EmojiView::Populate() if(value.type() == orcus::json_node_t::object) { - //iterate each element to get the keys + // iterate each element to get the keys std::vector<orcus::pstring> aEmojiParams = value.keys(); OUString sTitle, sCategory; + bool bDuplicate = false; for (auto paramIter = aEmojiParams.begin(); paramIter != aEmojiParams.end(); ++paramIter) { orcus::pstring paramVal = *paramIter; node prop = value.child(paramVal); - //get values of parameters in AppendItem() function + // get values of parameters in AppendItem() function if(paramVal == "unicode") { sTitle = rtl::OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); @@ -142,11 +143,19 @@ void EmojiView::Populate() { sCategory = rtl::OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8); } + else if(paramVal == "duplicate") + { + bDuplicate = true; + } } - //TODO: Check whether the glyph is present in the font file - //If the glyph is present, Call EmojiView::AppendItem() to populate each template as it is parsed - AppendItem(sTitle, sCategory); + // TODO: Check whether the glyph is present in the font file + // If the glyph is present, Call EmojiView::AppendItem() to populate each template as it is parsed + // Don't append if a duplicate emoji + if(!bDuplicate) + { + AppendItem(sTitle, sCategory); + } } } } |