[Release] wrt-installer_0.1.85
[platform/framework/web/wrt-installer.git] / src / configuration_parser / widget_parser.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 5a56c0f..00c9fc3
@@ -724,7 +724,7 @@ class ContentParser : public ElementParser
 
     virtual void Verify()
     {
-        if(!!m_data.startFile)
+        if(!!m_data.startFileEncountered)
         {
             if(m_data.startFileNamespace == m_namespace
                 || m_namespace != ConfigurationNamespace::TizenWebAppNamespaceName)
@@ -734,6 +734,7 @@ class ContentParser : public ElementParser
             //else continue -> if previous item was not in tizen namespace
         }
 
+        m_data.startFileEncountered = true;
         m_data.startFileNamespace = m_namespace;
 
         //we're consciously setting startFile even if m_src is null or invalid.
@@ -1373,24 +1374,33 @@ class SplashParser : public ElementParser
 
     virtual void Accept(const XmlAttribute& attribute)
     {
-        if (attribute.name == L"src") {
-            if (attribute.value.size() > 0) {
-                m_src = attribute.value;
+        if (m_properNamespace)
+        {
+            if (attribute.name == L"src") {
+                if (attribute.value.size() > 0) {
+                    m_src = attribute.value;
+                }
             }
         }
     }
 
-    virtual void Accept(const Element& /*element*/)
-    {}
+    virtual void Accept(const Element& element)
+    {
+        if (element.ns ==
+            ConfigurationNamespace::TizenWebAppNamespaceName)
+        {
+            m_properNamespace = true;
+        }
+    }
 
     virtual void Accept(const Text& /*text*/)
     {}
 
     virtual void Verify()
     {
-        if (m_src.IsNull()) {
-            LogWarning(
-                "src attribute of splash element is mandatory - ignoring");
+        if (m_src.IsNull())
+        {
+            LogWarning("src attribute of splash element is mandatory - ignoring");
             return;
         }
 
@@ -1399,12 +1409,14 @@ class SplashParser : public ElementParser
 
     SplashParser(ConfigParserData& data) :
         ElementParser(),
-        m_data(data)
+        m_data(data),
+        m_properNamespace(false)
     {}
 
   private:
     DPL::OptionalString m_src;
     ConfigParserData& m_data;
+    bool m_properNamespace;
 };
 
 class BackgroundParser : public ElementParser
@@ -1616,14 +1628,18 @@ class AppWidgetParser : public ElementParser
 
         virtual void Verify()
         {
+            std::pair<DPL::String, DPL::String> boxLabel;
             if (m_label.empty()) {
-                ThrowMsg(Exception::ParseError,
-                        "box-label element cannot be empty - ignoring");
+                LogWarning("box-label element is empty");
+                boxLabel.first = DPL::FromUTF8String("");
+                boxLabel.second = DPL::FromUTF8String("");
+                m_data.m_label.push_back(boxLabel);
+            }
+            else {
+                boxLabel.first = m_lang;
+                boxLabel.second = m_label;
+                m_data.m_label.push_back(boxLabel);
             }
-            std::pair<DPL::String, DPL::String> boxLabel;
-            boxLabel.first = m_lang;
-            boxLabel.second = m_label;
-            m_data.m_label.push_back(boxLabel);
         }
 
         BoxLabelParser(ConfigParserData::LiveboxInfo& data) :
@@ -1705,6 +1721,9 @@ class AppWidgetParser : public ElementParser
                     if (attribute.name == L"preview") {
                         m_preview = attribute.value;
                     }
+                    if (attribute.name == L"use-decoration") {
+                        m_useDecoration = attribute.value;
+                    }
                 }
             }
 
@@ -1731,10 +1750,11 @@ class AppWidgetParser : public ElementParser
                         "size is mandatory - ignoring");
                 }
 
-                std::pair<DPL::String, DPL::String> boxSize;
-                boxSize.first = m_size;
-                boxSize.second = m_preview;
-                m_data.m_boxSize.push_back(boxSize);
+                ConfigParserData::LiveboxInfo::BoxSizeInfo boxSizeInfo;
+                boxSizeInfo.m_size = m_size;
+                boxSizeInfo.m_preview = m_preview;
+                boxSizeInfo.m_useDecoration = m_useDecoration;
+                m_data.m_boxSize.push_back(boxSizeInfo);
             }
 
             explicit BoxSizeParser(
@@ -1747,6 +1767,7 @@ class AppWidgetParser : public ElementParser
           private:
             DPL::String m_size;
             DPL::String m_preview;
+            DPL::String m_useDecoration;
             bool m_properNamespace;
             ConfigParserData::LiveboxInfo::BoxContentInfo& m_data;
         };
@@ -2615,9 +2636,9 @@ class MetadataParser : public ElementParser
         }
         NormalizeString(m_key);
         NormalizeString(m_value);
-        ConfigParserData::Metadata metaData(*m_key, *m_value);
+        ConfigParserData::Metadata metaData(m_key, m_value);
         FOREACH(it, m_data.metadataList) {
-            if (!DPL::StringCompare(it->key, *m_key)) {
+            if (!DPL::StringCompare(*it->key, *m_key)) {
                 LogError("Key isn't unique");
                 return;
             }