Generate <category> in platform manifest 83/49983/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 22 Oct 2015 08:56:26 +0000 (10:56 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Fri, 23 Oct 2015 12:26:46 +0000 (05:26 -0700)
Category generation was missing.

Change-Id: Ie9e478047d6bd95f180fd891dd724bdc00e80250

src/common/step/step_generate_xml.cc
src/wgt/step/step_parse.cc
src/wgt/step/step_parse.h

index a6fed57..5529cbd 100755 (executable)
@@ -168,6 +168,15 @@ common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml(
     xmlTextWriterEndElement(writer);
   }
 
+  category_x* category = nullptr;
+  PKGMGR_LIST_MOVE_NODE_TO_HEAD(app->category, category);
+  for (; category; category = category->next) {
+    xmlTextWriterStartElement(writer, BAD_CAST "category");
+    xmlTextWriterWriteAttribute(writer, BAD_CAST "name",
+        BAD_CAST category->name);
+    xmlTextWriterEndElement(writer);
+  }
+
   return Step::Status::OK;
 }
 
index 9d5dbfe..905ea5b 100755 (executable)
@@ -9,6 +9,7 @@
 #include <manifest_handlers/app_control_handler.h>
 #include <manifest_handlers/application_icons_handler.h>
 #include <manifest_handlers/application_manifest_constants.h>
+#include <manifest_handlers/category_handler.h>
 #include <manifest_handlers/content_handler.h>
 #include <manifest_handlers/metadata_handler.h>
 #include <manifest_handlers/setting_handler.h>
@@ -228,6 +229,23 @@ bool StepParse::FillPrivileges(manifest_x* manifest) {
   return true;
 }
 
+bool StepParse::FillCategories(manifest_x* manifest) {
+  std::shared_ptr<const CategoryInfoList> category_info =
+      std::static_pointer_cast<const CategoryInfoList>(parser_->GetManifestData(
+          app_keys::kTizenCategoryKey));
+  if (!category_info)
+    return true;
+
+  // there is one app atm
+  for (auto& category : category_info->categories) {
+    category_x* c = reinterpret_cast<category_x*>(
+        calloc(1, sizeof(category_x)));
+    c->name = strdup(category.c_str());
+    LISTADD(manifest->application->category, c);
+  }
+  return true;
+}
+
 bool StepParse::FillMetadata(manifest_x* manifest) {
   std::shared_ptr<const MetaDataInfo> meta_info =
       std::static_pointer_cast<const MetaDataInfo>(parser_->GetManifestData(
@@ -280,6 +298,8 @@ bool StepParse::FillManifestX(manifest_x* manifest) {
     return false;
   if (!FillAppControl(manifest))
     return false;
+  if (!FillCategories(manifest))
+    return false;
   if (!FillMetadata(manifest))
     return false;
   if (!FillExtraManifestInfo(manifest))
index 10df0f7..19b5631 100644 (file)
@@ -48,6 +48,7 @@ class StepParse : public common_installer::Step {
   bool FillApplicationInfo(manifest_x* manifest);
   bool FillAppControl(manifest_x* manifest);
   bool FillPrivileges(manifest_x* manifest);
+  bool FillCategories(manifest_x* manifest);
   bool FillMetadata(manifest_x* manifest);
   bool FillExtraManifestInfo(manifest_x* manifest);
   bool FillAccounts(manifest_x* manifest);