Support 'fast-open' attribute of <tizen:pd>
authorYunchan Cho <yunchan.cho@samsung.com>
Thu, 25 Apr 2013 13:36:16 +0000 (22:36 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Sun, 28 Apr 2013 15:15:15 +0000 (00:15 +0900)
[Issue#] N/A
[Problem] For opening PD fast, developers can use 'fast-open' attribute of <tizen:pd>.
          But, wrt-installer is not considered for this.
[Cause] This is new requirement for web livebox
[Solution] wrt-installer parses 'fast-open' attribute and inserts its value to web-provider's DB
[SCMRequest] This patch is dependancy to the following two patches.
             wrt-commons: https://tizendev.org/gerrit/#/c/65035/
             web-provider: https://tizendev.org/gerrit/#/c/64752/

Change-Id: I7a86223bb9a7047462acd59448a075a0222d4fd4

src/configuration_parser/widget_parser.cpp
src/jobs/widget_install/task_database.cpp

index 1281ea6..289e30d 100644 (file)
@@ -1741,6 +1741,8 @@ class AppWidgetParser : public ElementParser
                         m_width = attribute.value;
                     } else if (attribute.name == L"height") {
                         m_height = attribute.value;
+                    } else if (attribute.name == L"fast-open") {
+                        m_fastOpen= attribute.value;
                     }
                 }
             }
@@ -1762,6 +1764,7 @@ class AppWidgetParser : public ElementParser
                 m_data.m_pdSrc = m_src;
                 m_data.m_pdWidth = m_width;
                 m_data.m_pdHeight = m_height;
+                m_data.m_pdFastOpen = m_fastOpen;
             }
 
             explicit PdParser(
@@ -1775,6 +1778,7 @@ class AppWidgetParser : public ElementParser
             DPL::String m_src;
             DPL::String m_width;
             DPL::String m_height;
+            DPL::String m_fastOpen;
 
             bool m_properNamespace;
             ConfigParserData::LiveboxInfo::BoxContentInfo& m_data;
index bf49632..0258359 100644 (file)
@@ -304,12 +304,13 @@ void TaskDatabase::StepLiveboxDBInsert()
 
     std::string tizenId = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
 
+    // insert specific information to web livebox db
     for (auto it = m_context.widgetConfig.configInfo.m_livebox.begin();
          it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
     {
         std::string boxId = DPL::ToUTF8String((**it).m_liveboxId);
         std::string boxType;
-        if ((**it).m_type == L"") {
+        if ((**it).m_type.empty()) {
             boxType = web_provider_livebox_get_default_type();
         } else {
             boxType = DPL::ToUTF8String((**it).m_type);
@@ -317,29 +318,18 @@ void TaskDatabase::StepLiveboxDBInsert()
         LogInfo("livebox id: " << boxId);
         LogInfo("livebox type: " << boxType);
 
-        int autoLaunch;
-        if ((**it).m_autoLaunch == L"true") {
-            autoLaunch = 1;
-        } else {
-            autoLaunch = 0;
-        }
+        int autoLaunch = (**it).m_autoLaunch == L"true" ? 1 : 0;
         LogInfo("livebox auto-launch: " << autoLaunch);
 
-        int mouseEvent;
-        if ((**it).m_boxInfo.m_boxMouseEvent == L"true") {
-            mouseEvent = 1;
-        } else {
-            mouseEvent = 0;
-        }
+        int mouseEvent = (**it).m_boxInfo.m_boxMouseEvent == L"true" ? 1 : 0;
         LogInfo("livebox mouse-event: " << mouseEvent);
 
-        int ret =
-            web_provider_livebox_insert_box_info(
-                boxId.c_str(), tizenId.c_str(), boxType.c_str(), autoLaunch, mouseEvent);
+        int pdFastOpen = (**it).m_boxInfo.m_pdFastOpen == L"true" ? 1 : 0;
+        LogInfo("livebox pd fast-open: " << pdFastOpen);
 
-        if (ret < 0) {
-            LogDebug("failed to set type of livebox: " << boxId);
-        }
+        web_provider_livebox_insert_box_info(
+                boxId.c_str(), tizenId.c_str(), boxType.c_str(),
+                autoLaunch, mouseEvent, pdFastOpen);
     }
 }
 } //namespace WidgetInstall