<!-- Widget Configuration Document Extensions XSD For TIZEN -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tizen="http://tizen.org/ns/widgets" targetNamespace="http://tizen.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
<xs:import namespace="http://www.w3.org/ns/widgets" schemaLocation="config.xsd"/>
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xs:simpleType name="appserviceOperationType">
<!--
<xs:restriction base="xs:token">
<xs:all>
<xs:element ref="tizen:box-label"/>
<xs:element ref="tizen:box-icon"/>
- <xs:element ref="tizen:box-content"/>
+ <!--xs:element ref="tizen:box-content"/-->
</xs:all>
<xs:attribute name="id" type="tizen:appWidgetIdType" use="required"/>
<xs:attribute name="primary" type="widgets:data.boolean" use="required"/>
</xs:restriction>
</xs:simpleType>
+<xs:element name="account">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="tizen:icon" />
+ <xs:element ref="tizen:display-name" />
+ <xs:element name="capability" type="xs:string"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="multiple-account-support" use="required" type="widgets:data.boolean"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="icon">
+ <xs:complexType>
+ <xs:attribute name="section" use="required" type="xs:string"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="display-name">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+</xs:element>
+
</xs:schema>
DPL::OptionalString m_policy;
};
+class AccountParser : public ElementParser
+{
+ public:
+ struct AccountProviderParser : public ElementParser
+ {
+ public:
+
+ struct IconParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ 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 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 Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
+ icon.first = m_type;
+ icon.second = *m_value;
+
+ m_data.m_iconSet.insert(icon);
+ }
+
+ IconParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data),
+ m_type(ConfigParserData::DefaultIcon)
+ {}
+
+ private:
+ bool m_properNamespace;
+ ConfigParserData::IconSectionType m_type;
+ DPL::OptionalString m_value;
+ ConfigParserData::AccountProvider& m_data;
+ };
+
+ struct DisplayNameParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
+ }
+ m_value = text.value;
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ m_lang = element.lang;
+ m_value= L"";
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ std::pair<DPL::String, DPL::String> name;
+ name.first = *m_lang;
+ name.second = *m_value;
+
+ m_data.m_displayNameSet.insert(name);
+ }
+
+ DisplayNameParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ 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;
+ }
+
+ 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 XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+ m_data.m_capabilityList.push_back(*m_value);
+ }
+
+ CapabilityParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ 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;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"multiple-accounts-support") {
+ if (attribute.value == L"") {
+ return;
+ }
+
+ if (attribute.value == L"ture") {
+ m_multiSupport = true;
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_multiAccountSupport = m_multiSupport;
+ }
+
+ ElementParserPtr OnIconElement()
+ {
+ return ElementParserPtr(new IconParser(m_data));
+ }
+
+ ElementParserPtr OnDisplayNameElement()
+ {
+ return ElementParserPtr(new DisplayNameParser(m_data));
+ }
+
+ ElementParserPtr OnCapabilityElement()
+ {
+ return ElementParserPtr(new CapabilityParser(m_data));
+ }
+
+ AccountProviderParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data),
+ m_multiSupport(false)
+ {}
+
+ 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;
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Verify()
+ {}
+
+ ElementParserPtr OnProviderElement()
+ {
+ return ElementParserPtr(new AccountProviderParser(m_account));
+ }
+
+ AccountParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_account(data.accountProvider),
+ m_properNamespace(false)
+ {}
+
+ private:
+ ConfigParserData& m_data;
+ ConfigParserData::AccountProvider& m_account;
+ bool m_properNamespace;
+ bool m_multiSupport;
+};
+
ElementParser::ActionFunc WidgetParser::GetElementParser(
const DPL::String& /*ns*/,
const DPL::String&
&WidgetParser::
OnCspReportOnlyElement);
#endif
+ m_map[L"account"] = DPL::MakeDelegate(this, &WidgetParser::OnAccountElement);
}
ElementParserPtr WidgetParser::OnNameElement()
return ElementParserPtr(new CspReportOnlyParser(m_data));
}
+ElementParserPtr WidgetParser::OnAccountElement()
+{
+ return ElementParserPtr(new AccountParser(m_data));
+}
+
void WidgetParser::Accept(const Element& element)
{
if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&
FOREACH(l, this->livebox) {
l->serialize(writer);
}
+ FOREACH(acc, this->account)
+ {
+ acc->serialize(writer);
+ }
}
endElement(writer);
}
endElement(writer);
}
+
+void Account::serialize(xmlTextWriterPtr writer)
+{
+ startElement(writer, "account");
+ {
+ startElement(writer, "account-provider");
+ writeAttribute(writer, "app-id", this->provider.appid);
+ writeAttribute(writer, "multiple-accounts-support",
+ this->provider.multiAccount);
+
+ FOREACH(i, this->provider.icon)
+ {
+ startElement(writer, "icon");
+ writeAttribute(writer, "section", i->first);
+ writeText(writer, i->second);
+ endElement(writer);
+ }
+ FOREACH(n, this->provider.name)
+ {
+ writeElementWithOneAttribute(writer, "label",
+ n->getString(), "xml:lang",
+ n->getLang(), n->hasLang());
+ }
+ FOREACH(c, this->provider.capability)
+ {
+ startElement(writer, "capability");
+ writeText(writer, *c);
+ endElement(writer);
+ }
+ endElement(writer);
+ }
+ endElement(writer);
+}
} //namespace Jobs
} //namespace WidgetInstall
setAppControlInfo(uiApp);
setAppCategory(uiApp);
setLiveBoxInfo(manifest);
+ setAccount(manifest);
manifest.addUiApplication(uiApp);
manifest.generate(path);
manifest.addLivebox(liveBox);
}
}
+
+void TaskManifestFile::setAccount(Manifest& manifest)
+{
+ WrtDB::ConfigParserData::AccountProvider account =
+ m_context.widgetConfig.configInfo.accountProvider;
+
+ AccountProviderType provider;
+
+ if (account.m_iconSet.empty()) {
+ LogInfo("Widget doesn't contain Account");
+ return;
+ }
+ if (account.m_multiAccountSupport) {
+ provider.multiAccount = L"ture";
+ } else {
+ provider.multiAccount = L"false";
+ }
+ provider.appid = m_context.widgetConfig.tzAppid;
+
+ FOREACH(it, account.m_iconSet) {
+ std::pair<DPL::String, DPL::String> icon;
+
+ if (it->first == ConfigParserData::IconSectionType::DefaultIcon) {
+ icon.first = L"account";
+ } else if (it->first == ConfigParserData::IconSectionType::SmallIcon) {
+ icon.first = L"account-small";
+ }
+ icon.second = it->second;
+
+ provider.icon.push_back(icon);
+ }
+
+ FOREACH(it, account.m_displayNameSet) {
+ provider.name.push_back(LabelType(it->second, it->first));
+ }
+
+ FOREACH(it, account.m_capabilityList) {
+ provider.capability.push_back(*it);
+ }
+
+ Account accountInfo;
+ accountInfo.addAccountProvider(provider);
+ manifest.addAccount(accountInfo);
+}
+
} //namespace WidgetInstall
} //namespace Jobs