</xs:restriction>
</xs:simpleType>
+<xs:simpleType name="liveboxIdType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[0-9a-zA-Z]{1,}"/>
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="boxSizeType">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="1x1"/>
+ <xs:enumeration value="2x1"/>
+ <xs:enumeration value="2x2"/>
+ <xs:enumeration value="4x2"/>
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="pdWidth">
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="175"/>
+ <xs:maxInclusive value="720"/>
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="pdHeight">
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="175"/>
+ <xs:maxInclusive value="525"/>
+ </xs:restriction>
+</xs:simpleType>
+
<xs:element name="content">
<xs:complexType>
<xs:attribute name="src" use="required" type="xs:anyURI"/>
</xs:complexType>
</xs:element>
+<xs:element name="livebox">
+ <xs:complexType mixed="true">
+ <xs:all>
+ <xs:element ref="tizen:label"/>
+ <xs:element ref="tizen:icon"/>
+ <xs:element ref="tizen:box"/>
+ </xs:all>
+ <xs:attribute name="appid" type="tizen:liveboxIdType" use="required"/>
+ <xs:attribute name="auto_launch" type="widgets:data.boolean" use="optional"/>
+ <xs:attribute name="period" type="xs:float" use="optional"/>
+ <xs:attribute name="network" type="widgets:data.boolean" use="optional"/>
+ <xs:attribute name="nodisplay" type="widgets:data.boolean" use="optional"/>
+ <xs:attribute name="primary" type="widgets:data.boolean" use="required"/>
+ <xs:attribute name="timeout" type="xs:int" use="optional"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="label" type="xs:string"/>
+
+<xs:element name="icon">
+ <xs:complexType>
+ <xs:attribute name="src" use="required" type="xs:anyURI"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="box">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="tizen:boxsize" maxOccurs="4"/>
+ <xs:element ref="tizen:pd"/>
+ </xs:sequence>
+ <xs:attribute name="src" use="required" type="xs:anyURI"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="pd">
+ <xs:complexType>
+ <xs:attribute name="src" use="required" type="xs:anyURI"/>
+ <xs:attribute name="width" use="required" type="tizen:pdWidth"/>
+ <xs:attribute name="height" use="required" type="tizen:pdHeight"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="boxsize" type="tizen:boxSizeType">
+ <xs:attribute name="preview" use="optional" type="xs:anyURI"/>
+</xs:element>
+
</xs:schema>
ConfigParserData& m_data;
};
+class LiveboxParser : public ElementParser
+{
+ public:
+
+ struct LabelParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if(m_properNamespace)
+ m_label = text.value;
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_label = m_label;
+ }
+
+ LabelParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_label;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ };
+
+ struct IconParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"src") {
+ m_icon = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_icon = m_icon;
+ }
+
+ explicit IconParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_icon;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ };
+
+ struct BoxParser : public ElementParser
+ {
+ struct PdParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"src") {
+ m_src = attribute.value;
+ } else if (attribute.name == L"width") {
+ m_width = attribute.value;
+ } else if (attribute.name == L"height") {
+ m_height = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_pdSrc = m_src;
+ m_data.m_pdWidth = m_width;
+ m_data.m_pdHeight = m_height;
+ }
+
+ explicit PdParser(ConfigParserData::LiveboxInfo::Box& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_src;
+ DPL::String m_width;
+ DPL::String m_height;
+
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box& m_data;
+ };
+
+ struct SizeParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"preview") {
+ m_preview = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if(m_properNamespace)
+ m_size = text.value;
+ }
+
+ virtual void Verify()
+ {
+ std::pair<DPL::String, DPL::String> boxSize;
+ boxSize.first = m_size;
+ boxSize.second = m_preview;
+ m_data.m_boxSize.push_back(boxSize);
+ }
+
+ explicit SizeParser(ConfigParserData::LiveboxInfo::Box& data) :
+ ElementParser(),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_size;
+ DPL::String m_preview;
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box& m_data;
+ };
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"boxsize") {
+ return DPL::MakeDelegate(this, &LiveboxParser::BoxParser::OnSizeElement);
+ } else if (name == L"pd") {
+ return DPL::MakeDelegate(this, &LiveboxParser::BoxParser::OnPdElement);
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (m_properNamespace) {
+ if (attribute.name == L"src")
+ m_box.m_boxSrc = attribute.value;
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_boxInfo = m_box;
+ }
+
+ explicit BoxParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ ElementParserPtr OnPdElement()
+ {
+ return ElementParserPtr(new PdParser(m_box));
+ }
+
+ ElementParserPtr OnSizeElement()
+ {
+ return ElementParserPtr(new SizeParser(m_box));
+ }
+
+ private:
+ DPL::String m_src;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box m_box;
+
+ };
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"label") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnLabelElement);
+ } else if (name == L"icon") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnIconElement);
+ } else if (name == L"box") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnBoxElement);
+ } else {
+ return &IgnoringParser::Create;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (m_properNamespace) {
+ if (attribute.name == L"appid") {
+ m_appId = attribute.value;
+ } else if (attribute.name == L"auto_launch") {
+ m_autoLaunch = attribute.value;
+ } else if (attribute.name == L"period") {
+ m_period = attribute.value;
+ } else if (attribute.name == L"network") {
+ m_network = attribute.value;
+ LogDebug("@@@ "<<m_network);
+ } else if (attribute.name == L"nodisplay") {
+ m_nodisplay = attribute.value;
+ } else if (attribute.name == L"primary") {
+ m_primary = attribute.value;
+ } else if (attribute.name == L"timeout") {
+ m_timeout = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_livebox.m_appId = m_appId;
+ m_livebox.m_autoLaunch = m_autoLaunch;
+ m_livebox.m_period = m_period;
+ m_livebox.m_network = m_network;
+ m_livebox.m_nodisplay = m_nodisplay;
+ m_livebox.m_primary = m_primary;
+ m_livebox.m_timeout = m_timeout;
+
+ m_data.m_livebox.push_back(m_livebox);
+ }
+
+ explicit LiveboxParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_properNamespace(false)
+ {
+ m_livebox = ConfigParserData::LiveboxInfo();
+ }
+
+ ElementParserPtr OnLabelElement()
+ {
+ return ElementParserPtr(new LabelParser(m_livebox));
+ }
+
+ ElementParserPtr OnIconElement()
+ {
+ return ElementParserPtr(new IconParser(m_livebox));
+ }
+ ElementParserPtr OnBoxElement()
+ {
+ return ElementParserPtr(new BoxParser(m_livebox));
+ }
+
+ private:
+ ConfigParserData& m_data;
+ ConfigParserData::LiveboxInfo m_livebox;
+ DPL::String m_appId;
+ DPL::String m_autoLaunch;
+ DPL::String m_period;
+ DPL::String m_network;
+ DPL::String m_nodisplay;
+ DPL::String m_primary;
+ DPL::String m_timeout;
+ bool m_properNamespace;
+
+};
+
ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/,
const DPL::String& name)
{
&WidgetParser::OnAppControlElement);
m_map[L"category"] = DPL::MakeDelegate(this,
&WidgetParser::OnCategoryElement);
+ m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
+
}
ElementParserPtr WidgetParser::OnNameElement()
return ElementParserPtr(new CategoryParser(m_data));
}
+ElementParserPtr WidgetParser::OnLiveboxElement()
+{
+ return ElementParserPtr(new LiveboxParser(m_data));
+}
+
void WidgetParser::Accept(const Element& element)
{
if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&
ElementParserPtr OnPrivilegeElement();
ElementParserPtr OnAppControlElement();
ElementParserPtr OnCategoryElement();
+ ElementParserPtr OnLiveboxElement();
virtual ActionFunc GetElementParser(const DPL::String& ns,
const DPL::String& name);
{
AddTask(new TaskRemoveBackupFiles(m_installerContext));
}
-
AddTask(new TaskPluginsCopy(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
FOREACH(u, this->uiApplication) { u->serialize(writer); }
FOREACH(i, this->imeApplication) { i->serialize(writer); }
//FOREACH(f, this->font) { f->serialize(writer); }
+ FOREACH(l, this->livebox) { l->serialize(writer); }
}
endElement(writer);
}
}
endElement(writer);
}
+
+void LiveBox::serialize(xmlTextWriterPtr writer)
+{
+ startElement(writer, "livebox");
+ if(!this->appid.empty()) {
+ writeAttribute(writer, "appid", this->appid);
+ }
+ if(!this->auto_launch.empty()) {
+ writeAttribute(writer, "auto_launch", this->auto_launch);
+ }
+ if(!this->network.empty()) {
+ writeAttribute(writer, "network", this->network);
+ }
+ writeAttribute(writer, "abi", "html");
+ if(!this->period.empty()) {
+ writeAttribute(writer, "period", this->period);
+ }
+ if(!this->nodisplay.empty()) {
+ writeAttribute(writer, "nodisplay", this->nodisplay);
+ }
+ if(!this->primary.empty()) {
+ writeAttribute(writer, "primary", this->primary);
+ }
+ if(!this->timeout.empty()) {
+ writeAttribute(writer, "timeout", this->timeout);
+ }
+ if(!this->label.empty()) {
+ startElement(writer, "label");
+ writeText(writer, this->label);
+ endElement(writer);
+ }
+
+ if(!this->icon.empty()) {
+ startElement(writer, "icon");
+ writeText(writer, this->icon);
+ endElement(writer);
+ }
+
+ if(!this->box.boxSrc.empty() && !this->box.boxSize.empty())
+ {
+ startElement(writer, "box");
+ writeAttribute(writer, "type", "buffer");
+
+ FOREACH(m, this->box.boxSize)
+ {
+ std::pair<DPL::String, DPL::String> boxSize = *m;
+ startElement(writer, "size");
+ if(!boxSize.second.empty())
+ writeAttribute(writer, "preview", boxSize.second);
+ writeText(writer, boxSize.first);
+ endElement(writer);
+ }
+
+ startElement(writer, "script");
+ writeAttribute(writer, "src", this->box.boxSrc);
+ endElement(writer);
+
+ endElement(writer);
+
+ if(!this->box.pdSrc.empty() && ! this->box.pdWidth.empty() && ! this->box.pdHeight.empty()) {
+ startElement(writer, "pd");
+ writeAttribute(writer, "type", "buffer");
+
+ startElement(writer, "size");
+ DPL::String pdSize = this->box.pdWidth+DPL::String(L"x")+this->box.pdHeight;
+ writeText(writer, pdSize);
+ endElement(writer);
+
+ startElement(writer, "script");
+ writeAttribute(writer, "src", this->box.pdSrc);
+ endElement(writer);
+
+ endElement(writer);
+ }
+ }
+
+ endElement(writer);
+}
+
} //namespace Jobs
} //namespace WidgetInstall
typedef UiApplication UiApplicationType;
/**
+ * @brief LiveBox element
+ */
+typedef std::list<std::pair<DPL::String, DPL::String>> boxSizeType;
+
+
+struct BoxInfo
+{
+ NcnameType boxSrc;
+ boxSizeType boxSize;
+ NcnameType pdSrc;
+ NcnameType pdWidth;
+ NcnameType pdHeight;
+};
+typedef BoxInfo BoxInfoType;
+
+class LiveBox
+{
+public:
+ LiveBox() { }
+ void setAppid(const NcnameType &x) { this->appid = x; }
+ void setAutoLaunch(const NcnameType &x) { this->auto_launch = x; }
+ void setPeriod(const NcnameType &x) { this->period = x; }
+ void setNetwork(const NcnameType &x) { this->network = x; }
+ void setNodisplay(const NcnameType &x) { this->nodisplay = x; }
+ void setPrimary(const NcnameType &x) { this->primary = x; }
+ void setTimeout(const NcnameType &x) { this->timeout = x; }
+ void setLabel(const NcnameType &x) { this->label = x; }
+ void setIcon(const NcnameType &x) { this->icon = x; }
+ void setBox(const BoxInfoType &x) { this->box = x; }
+
+ void serialize(xmlTextWriterPtr writer);
+
+private:
+ NcnameType appid;
+ NcnameType auto_launch;
+ NcnameType period;
+ NcnameType network;
+ NcnameType nodisplay;
+ NcnameType primary;
+ NcnameType timeout;
+ NcnameType label;
+ NcnameType icon;
+ BoxInfoType box;
+};
+
+typedef LiveBox LiveBoxInfo;
+
+/**
* @brief manifest element
*
* Manifest xml file representation.
}
// void addFont(const FontType &x) { this->font.push_back(x); }
+ void addLivebox(const LiveBoxInfo &x)
+ {
+ this->livebox.push_back(x);
+ }
+
void setInstallLocation(const InstallLocationType &x)
{
this->installLocation = x;
std::list<UiApplicationType> uiApplication;
std::list<ImeApplicationType> imeApplication;
// std::list<FontType> font;
+ std::list<LiveBoxInfo> livebox;
InstallLocationType installLocation;
NcnameType package;
PackageType type;
setWidgetOtherInfo(uiApp);
setAppServiceInfo(uiApp);
setAppCategory(uiApp);
+ setLiveBoxInfo(manifest);
manifest.addUiApplication(uiApp);
manifest.generate(path);
{
LogWarning("No manifest file found: " << manifest_file);
}
+}
+
+void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
+{
+
+ FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
+
+ LogInfo("setLiveBoxInfo");
+ LiveBoxInfo liveBox;
+ DPL::String pkgname;
+ DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
+
+ if(!!m_context.widgetConfig.pkgname)
+ {
+ pkgname =
+ *m_context.widgetConfig.pkgname+DPL::String(L".")
+ +ConfigInfo->m_appId;
+ liveBox.setAppid(pkgname);
+ }
+
+ if(ConfigInfo->m_autoLaunch !=L"") {
+ liveBox.setAutoLaunch(ConfigInfo->m_autoLaunch);
+ }
+
+ if(ConfigInfo->m_period !=L"")
+ liveBox.setPeriod(ConfigInfo->m_period);
+
+ if(ConfigInfo->m_network !=L"")
+ liveBox.setNetwork(ConfigInfo->m_network);
+
+ if(ConfigInfo->m_nodisplay !=L"")
+ liveBox.setNodisplay(ConfigInfo->m_nodisplay);
+
+ if(ConfigInfo->m_primary !=L"")
+ liveBox.setPrimary(ConfigInfo->m_primary);
+
+ if(ConfigInfo->m_timeout !=L"")
+ liveBox.setTimeout(ConfigInfo->m_timeout);
+
+ if(ConfigInfo->m_label !=L"")
+ liveBox.setLabel(ConfigInfo->m_label);
+
+ DPL::String defaultLocale
+ = DPL::FromUTF8String(m_context.locations->getPackageInstallationDir())
+ + DPL::String(L"/res/wgt/");
+
+ if(ConfigInfo->m_icon!=L"") {
+ liveBox.setIcon(defaultLocale+ConfigInfo->m_icon);
+ }
+
+ if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) {
+ LogInfo("Widget doesn't contain box");
+ return;
+ } else {
+ BoxInfoType box;
+ if (!ConfigInfo->m_boxInfo.m_boxSrc.empty()) {
+ if((std::string::npos != ConfigInfo->m_boxInfo.m_boxSrc.find(L"http"))
+ || (std::string::npos != ConfigInfo->m_boxInfo.m_boxSrc.find(L"https")))
+ box.boxSrc = ConfigInfo->m_boxInfo.m_boxSrc;
+ else
+ box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc;
+ }
+
+ std::list<std::pair<DPL::String,DPL::String>> BoxSizeList
+ = ConfigInfo->m_boxInfo.m_boxSize;
+ FOREACH(im, BoxSizeList) {
+ std::pair<DPL::String, DPL::String> boxSize = *im;
+ if(!boxSize.second.empty())
+ boxSize.second = defaultLocale + boxSize.second;
+ box.boxSize.push_back(boxSize);
+ }
+
+ if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
+ && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
+ && !ConfigInfo->m_boxInfo.m_pdHeight.empty()) {
+ box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
+ box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth;
+ box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight;
+ }
+
+ liveBox.setBox(box);
+ }
+
+ manifest.addLivebox(liveBox);
+ }
}
void setWidgetOtherInfo(UiApplication & uiApp);
void setAppServiceInfo(UiApplication & uiApp);
void setAppCategory(UiApplication & uiApp);
+ void setLiveBoxInfo(Manifest& manifest);
void generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved);
void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, bool & defaultIconSaved);