Support 'use-decoration' attribute of <tizen:box-size>
authorYunchan Cho <yunchan.cho@samsung.com>
Tue, 18 Jun 2013 12:36:34 +0000 (21:36 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 20 Jun 2013 12:16:28 +0000 (12:16 +0000)
[Issue#] N/A
[Problem] frame decoration feature was not supported on dynamic box
[Cause] There is no way for developer to apply frame decoration of dynamic box
[Solution] For this, 'use-decoration' attribute has been added to <tizen:box-size>
           'use-decoration' attribute is optional, and can have 'true' or 'false' as value.
           default value is 'true'
[SCMRequest] Depends on: wrt-commons. https://review.tizenrsa.org/#/c/75079/

Change-Id: I08fff1d8f022d6de0c2835cce0e7c100b1c8550d

configuration/widgets.tizen.xsd
src/configuration_parser/widget_parser.cpp
src/jobs/widget_install/manifest.cpp
src/jobs/widget_install/manifest.h
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_widget_config.cpp

index 0a7b508..1b7c8c6 100644 (file)
     <xs:element name="box-size">
         <xs:complexType mixed="true">
         <xs:attribute name="preview" use="optional" type="xs:anyURI"/>
+        <xs:attribute name="use-decoration" use="optional" type="tizen:data.boolean"/>
         </xs:complexType>
     </xs:element>
 
index d2a17b9..00c9fc3 100644 (file)
@@ -1721,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;
+                    }
                 }
             }
 
@@ -1747,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(
@@ -1763,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;
         };
index 6a62c0c..7a8bea6 100644 (file)
@@ -407,14 +407,20 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
         writeAttribute(writer, "mouse_event", this->box.boxMouseEvent);
         writeAttribute(writer, "touch_effect", this->box.boxTouchEffect);
 
-        FOREACH(m, this->box.boxSize)
+        FOREACH(it, this->box.boxSize)
         {
-            std::pair<DPL::String, DPL::String> boxSize = *m;
             startElement(writer, "size");
-            if (!boxSize.second.empty()) {
-                writeAttribute(writer, "preview", boxSize.second);
+            if (!(*it).m_preview.empty()) {
+                writeAttribute(writer, "preview", (*it).m_preview);
             }
-            writeText(writer, boxSize.first);
+            if (!(*it).m_useDecoration.empty()) {
+                writeAttribute(writer, "need_frame", (*it).m_useDecoration);
+            } else {
+                // default value of use-decoration is "true"
+                writeAttribute(writer, "need_frame", DPL::String(L"true"));
+            }
+
+            writeText(writer, (*it).m_size);
             endElement(writer);
         }
 
index da78fe8..1729716 100644 (file)
@@ -29,6 +29,7 @@
 #include <dpl/string.h>
 #include <dpl/optional_typedefs.h>
 #include <dpl/foreach.h>
+#include <dpl/wrt-dao-ro/config_parser_data.h>
 
 namespace Jobs {
 namespace WidgetInstall {
@@ -405,15 +406,15 @@ typedef UiApplication UiApplicationType;
 /**
  * @brief LiveBox element
  */
-typedef std::list<std::pair<DPL::String, DPL::String> > boxSizeType;
-typedef std::list<std::pair<DPL::String, DPL::String> > boxLabelType;
+typedef WrtDB::ConfigParserData::LiveboxInfo::BoxSizeList BoxSizeType;
+typedef WrtDB::ConfigParserData::LiveboxInfo::BoxLabelList BoxLabelType;
 
 struct BoxInfo
 {
     NcnameType boxSrc;
     NcnameType boxMouseEvent;
     NcnameType boxTouchEffect;
-    boxSizeType boxSize;
+    BoxSizeType boxSize;
     NcnameType pdSrc;
     NcnameType pdWidth;
     NcnameType pdHeight;
@@ -436,7 +437,7 @@ class LiveBox
     {
         this->updatePeriod = x;
     }
-    void setLabel(const boxLabelType &x)
+    void setLabel(const BoxLabelType &x)
     {
         this->label = x;
     }
@@ -457,7 +458,7 @@ class LiveBox
     NcnameType autoLaunch;
     NcnameType updatePeriod;
     NcnameType timeout;
-    boxLabelType label;
+    BoxLabelType label;
     NcnameType icon;
     NcnameType lang;
     BoxInfoType box;
index e320362..5ee73c6 100755 (executable)
@@ -36,6 +36,7 @@
 #include <web_provider_livebox_info.h>
 #include <web_provider_plugin_info.h>
 #include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-ro/config_parser_data.h>
 #include <dpl/log/log.h>
 #include <dpl/file_input.h>
 #include <dpl/errno_string.h>
@@ -315,9 +316,10 @@ void TaskManifestFile::stepCopyLiveboxFiles()
     std::ostringstream targetFile;
 
     FOREACH (boxIt, liveBoxList) {
-        boxSizeType boxSizeList = (**boxIt).m_boxInfo.m_boxSize;
+        ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
+            (**boxIt).m_boxInfo.m_boxSize;
         FOREACH (sizeIt, boxSizeList) {
-            std::string preview = DPL::ToUTF8String((*sizeIt).second);
+            std::string preview = DPL::ToUTF8String((*sizeIt).m_preview);
             if (preview.empty()) {
                 continue;
             }
@@ -326,7 +328,7 @@ void TaskManifestFile::stepCopyLiveboxFiles()
             sourceFile << preview;
             targetFile << m_context.locations->getSharedDataDir() << "/";
             targetFile << (**boxIt).m_liveboxId << ".";
-            targetFile << DPL::ToUTF8String((*sizeIt).first) << ".preview.png";
+            targetFile << DPL::ToUTF8String((*sizeIt).m_size) << ".preview.png";
 
             DPL::FileInput input(sourceFile.str());
             DPL::FileOutput output(targetFile.str());
@@ -1147,18 +1149,17 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
                 box.boxTouchEffect= L"false";
             }
 
-            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 =
+            ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
+                ConfigInfo->m_boxInfo.m_boxSize;
+            FOREACH(it, boxSizeList) {
+                if (!(*it).m_preview.empty()) {
+                    (*it).m_preview =
                         DPL::FromUTF8String(m_context.locations->getSharedDataDir()) +
                         DPL::String(L"/") +
                         ConfigInfo->m_liveboxId + DPL::String(L".") +
-                        boxSize.first + DPL::String(L".preview.png");
+                        (*it).m_size + DPL::String(L".preview.png");
                 }
-                box.boxSize.push_back(boxSize);
+                box.boxSize.push_back((*it));
             }
 
             if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
index f77a8b7..00c5fa0 100755 (executable)
@@ -34,6 +34,7 @@
 #include <dpl/utils/wrt_global_settings.h>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-ro/config_parser_data.h>
 #include <dpl/wrt-dao-rw/feature_dao.h>
 
 #include <libiriwrapper.h>
@@ -122,8 +123,6 @@ void TaskWidgetConfig::ReadLocaleFolders()
         return;
     }
 
-
-
     struct stat statStruct;
     struct dirent dirent;
     struct dirent *result;
@@ -537,13 +536,14 @@ void TaskWidgetConfig::StepVerifyLivebox()
 
         LogInfo("livebox type: " << boxType);
 
-        boxSizeType boxSizeList = (**it).m_boxInfo.m_boxSize;
+        ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
+            (**it).m_boxInfo.m_boxSize;
         char** boxSize = static_cast<char**>(
             malloc(sizeof(char*)* boxSizeList.size()));
 
         int boxSizeCnt = 0;
         FOREACH (m, boxSizeList) {
-            boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).first).c_str());
+            boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).m_size).c_str());
         }
 
         bool chkSize = web_provider_plugin_check_supported_size(