From 0e2be84071fd688fa0be9490d3854573479f8313 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Fri, 27 Sep 2013 15:44:30 +0900 Subject: [PATCH] Fixed installer couldn't add account to manifest file [Issue#] N_SE-53213 [Problem] Can't add account to manifest file even if account information is in config.xml. [Cause] Wrt-installer did not create the account information to manifest file when parsing config.xml. [Solution] Fixed parsing context to create the account information. [SCMRequest] N/A Change-Id: I51f2b3b7f1d6ff5a0593714c15e20cc64e09cdd9 --- src/configuration_parser/widget_parser.cpp | 386 +++++++++++++---------------- src/jobs/widget_install/manifest.cpp | 2 +- 2 files changed, 170 insertions(+), 218 deletions(-) diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 9d7284a..f39b478 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -2329,269 +2329,221 @@ class CspReportOnlyParser : public ElementParser class AccountParser : public ElementParser { public: - struct AccountProviderParser : public ElementParser + struct IconParser : public ElementParser { - public: - - struct IconParser : public ElementParser - { - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &IgnoringParser::Create; //ignore unknown according to w3c - } + public: + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& /*name*/) + { + return &IgnoringParser::Create; //ignore unknown according to w3c + } - virtual void Accept(const Text& text) - { - if (text.value == L"") { - return; - } - m_value = text.value; + virtual void Accept(const Text& text) + { + if (text.value == L"") { + return; } + m_value = text.value; + } - virtual void Accept(const Element& /*element*/) - {} + virtual void Accept(const Element& /*element*/) + {} - virtual void Accept(const XmlAttribute& attribute) - { - if (attribute.name == L"section") { - if (attribute.value == L"account") { - m_type = ConfigParserData::IconSectionType::DefaultIcon; - } else if (attribute.value == L"account-small") { - m_type = ConfigParserData::IconSectionType::SmallIcon; - } + virtual void Accept(const XmlAttribute& attribute) + { + if (attribute.name == L"section") { + if (attribute.value == L"Account") { + m_type = ConfigParserData::IconSectionType::DefaultIcon; + } else if (attribute.value == L"AccountSmall") { + m_type = ConfigParserData::IconSectionType::SmallIcon; } } + } - virtual void Verify() - { - if (m_value.IsNull() || *m_value == L"") { - return; - } - - std::pair icon; - icon.first = m_type; - icon.second = *m_value; - - m_data.m_iconSet.insert(icon); + virtual void Verify() + { + if (m_value.IsNull() || *m_value == L"") { + return; } - IconParser(ConfigParserData::AccountProvider& data) : - ElementParser(), - m_properNamespace(false), - m_type(ConfigParserData::DefaultIcon), - m_data(data) - {} + std::pair icon; + icon.first = m_type; + icon.second = *m_value; - private: - bool m_properNamespace; - ConfigParserData::IconSectionType m_type; - ConfigParserData::AccountProvider& m_data; - DPL::OptionalString m_value; - }; + m_data.m_iconSet.insert(icon); + } - struct DisplayNameParser : public ElementParser - { - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &IgnoringParser::Create; //ignore unknown according to w3c - } + IconParser(ConfigParserData::AccountProvider& data) : + ElementParser(), + m_properNamespace(false), + m_type(ConfigParserData::DefaultIcon), + m_data(data) + {} - virtual void Accept(const Text& text) - { - if (text.value == L"") { - return; - } - m_value = text.value; - } + private: + bool m_properNamespace; + ConfigParserData::IconSectionType m_type; + ConfigParserData::AccountProvider& m_data; + DPL::OptionalString m_value; + }; - virtual void Accept(const Element& element) - { - m_lang = element.lang; - m_value= L""; - } + struct DisplayNameParser : public ElementParser + { + public: + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& /*name*/) + { + return &IgnoringParser::Create; //ignore unknown according to w3c + } - virtual void Accept(const XmlAttribute& /*attribute*/) - {} + virtual void Accept(const Text& text) + { + if (text.value == L"") { + return; + } + m_value = text.value; + } - virtual void Verify() - { - if (m_value.IsNull() || *m_value == L"") { - return; - } + virtual void Accept(const Element& element) + { + m_lang = element.lang; + m_value= L""; + } - std::pair name; - name.first = *m_lang; - name.second = *m_value; + virtual void Accept(const XmlAttribute& /*attribute*/) + {} - m_data.m_displayNameSet.insert(name); + virtual void Verify() + { + if (m_value.IsNull() || *m_value == L"") { + return; } - DisplayNameParser(ConfigParserData::AccountProvider& data) : - ElementParser(), - m_properNamespace(false), - m_data(data) - {} + std::pair name; + name.first = *m_lang; + name.second = *m_value; - private: - bool m_properNamespace; - DPL::OptionalString m_lang; - DPL::OptionalString m_value; - ConfigParserData::AccountProvider& m_data; - }; - - struct CapabilityParser : public ElementParser - { - public: - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& /*name*/) - { - return &IgnoringParser::Create; //ignore unknown according to w3c - } + m_data.m_displayNameSet.insert(name); + } - virtual void Accept(const Text& text) - { - if (text.value == L"") { - return; - } - m_value = text.value; - } + DisplayNameParser(ConfigParserData::AccountProvider& data) : + ElementParser(), + m_properNamespace(false), + m_data(data) + {} - virtual void Accept(const Element& /*element*/) - {} + private: + bool m_properNamespace; + DPL::OptionalString m_lang; + DPL::OptionalString m_value; + ConfigParserData::AccountProvider& m_data; + }; - virtual void Accept(const XmlAttribute& /*attribute*/) - {} + struct CapabilityParser : public ElementParser + { + public: + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& /*name*/) + { + return &IgnoringParser::Create; //ignore unknown according to w3c + } - virtual void Verify() - { - if (m_value.IsNull() || *m_value == L"") { - return; - } - m_data.m_capabilityList.push_back(*m_value); + virtual void Accept(const Text& text) + { + if (text.value == L"") { + return; } + m_value = text.value; + } - CapabilityParser(ConfigParserData::AccountProvider& data) : - ElementParser(), - m_properNamespace(false), - m_data(data) + virtual void Accept(const Element& /*element*/) {} - private: - bool m_properNamespace; - DPL::OptionalString m_value; - ConfigParserData::AccountProvider& m_data; - }; - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& name) - { - if (name == L"icon") { - return DPL::MakeDelegate(this, &AccountProviderParser::OnIconElement); - } else if (name == L"display-name") { - return DPL::MakeDelegate(this, - &AccountProviderParser::OnDisplayNameElement); - } else if (name == L"capability") { - return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement); - } else { - return &IgnoringParser::Create; //ignore unknown according to w3c - } - } - - virtual void Accept(const Text& /*text*/) - {} + virtual void Accept(const XmlAttribute& /*attribute*/) + {} - virtual void Accept(const Element& /*element*/) - {} + virtual void Verify() + { + if (m_value.IsNull() || *m_value == L"") { + return; + } + m_data.m_capabilityList.push_back(*m_value); + } - virtual void Accept(const XmlAttribute& attribute) - { - if (attribute.name == L"multiple-accounts-support") { - if (attribute.value == L"true") { - m_multiSupport = true; - } - } - } + CapabilityParser(ConfigParserData::AccountProvider& data) : + ElementParser(), + m_properNamespace(false), + m_data(data) + {} - virtual void Verify() - { - m_data.m_multiAccountSupport = m_multiSupport; + private: + bool m_properNamespace; + DPL::OptionalString m_value; + ConfigParserData::AccountProvider& m_data; + }; + virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, + const DPL::String& name) + { + if (name == L"icon") { + return DPL::MakeDelegate(this, &AccountParser::OnIconElement); + } else if (name == L"display-name") { + return DPL::MakeDelegate(this, + &AccountParser::OnDisplayNameElement); + } else if (name == L"capability") { + return DPL::MakeDelegate(this, &AccountParser::OnCapabilityElement); + } else { + return &IgnoringParser::Create; //ignore unknown according to w3c } + } - ElementParserPtr OnIconElement() - { - return ElementParserPtr(new IconParser(m_data)); - } + virtual void Accept(const Text& /*text*/) + {} - ElementParserPtr OnDisplayNameElement() - { - return ElementParserPtr(new DisplayNameParser(m_data)); - } + virtual void Accept(const Element& /*element*/) + {} - ElementParserPtr OnCapabilityElement() - { - return ElementParserPtr(new CapabilityParser(m_data)); + virtual void Accept(const XmlAttribute& attribute) + { + if (attribute.name == L"multiple-account-support") { + if (attribute.value == L"true") { + m_account.m_multiAccountSupport = true; + } } + } - AccountProviderParser(ConfigParserData::AccountProvider& data) : - ElementParser(), - m_properNamespace(false), - m_multiSupport(false), - m_data(data) - {} - - private: - bool m_properNamespace; - bool m_multiSupport; - ConfigParserData::AccountProvider& m_data; - }; - - virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& name) - { - if (name == L"account-provider") { - return DPL::MakeDelegate(this, &AccountParser::OnProviderElement); - } else { - return &IgnoringParser::Create; //ignore unknown according to w3c - } - } - - virtual void Accept(const Element& element) - { - if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) { - m_properNamespace = true; - } - } + virtual void Verify() + { + } - virtual void Accept(const XmlAttribute& /*attribute*/) - {} + ElementParserPtr OnIconElement() + { + return ElementParserPtr(new IconParser(m_account)); + } - virtual void Accept(const Text& /*text*/) - {} + ElementParserPtr OnDisplayNameElement() + { + return ElementParserPtr(new DisplayNameParser(m_account)); + } - virtual void Verify() - {} + ElementParserPtr OnCapabilityElement() + { + return ElementParserPtr(new CapabilityParser(m_account)); + } - ElementParserPtr OnProviderElement() + AccountParser(ConfigParserData& data) : + ElementParser(), + m_properNamespace(false), + m_multiSupport(false), + m_data(data), + m_account(data.accountProvider) { - return ElementParserPtr(new AccountProviderParser(m_account)); } - AccountParser(ConfigParserData& data) : - ElementParser(), - m_data(data), - m_account(data.accountProvider), - m_properNamespace(false), - m_multiSupport(false) - {} - private: - ConfigParserData& m_data; - ConfigParserData::AccountProvider& m_account; - bool m_properNamespace; - bool m_multiSupport; + bool m_properNamespace; + bool m_multiSupport; + ConfigParserData& m_data; + ConfigParserData::AccountProvider& m_account; }; class MetadataParser : public ElementParser diff --git a/src/jobs/widget_install/manifest.cpp b/src/jobs/widget_install/manifest.cpp index 80b37b0..977f58e 100644 --- a/src/jobs/widget_install/manifest.cpp +++ b/src/jobs/widget_install/manifest.cpp @@ -460,7 +460,7 @@ void Account::serialize(xmlTextWriterPtr writer) startElement(writer, "account"); { startElement(writer, "account-provider"); - writeAttribute(writer, "app-id", this->provider.appid); + writeAttribute(writer, "appid", this->provider.appid); writeAttribute(writer, "multiple-accounts-support", this->provider.multiAccount); -- 2.7.4