add label, author element under manifest element 07/44007/3
authorInhwan Lee <ideal.lee@samsung.com>
Thu, 16 Jul 2015 06:24:16 +0000 (15:24 +0900)
committerInhwan Lee <ideal.lee@samsung.com>
Thu, 16 Jul 2015 07:19:41 +0000 (16:19 +0900)
not only <label> in <ui-application> but also <label> in <manifest>
and add <author> in <manifest>

request from pkgmgr team for work their C API

Change-Id: Ic460254662b001598dfe23c75e89cb382895898d

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

index 41ac592..6e5df8b 100755 (executable)
@@ -201,6 +201,44 @@ Step::Status StepGenerateXml::process() {
   xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
       BAD_CAST context_->manifest_data.get()->version);
 
+  if (!context_->manifest_data.get()->label) {
+    xmlTextWriterWriteFormatElement(writer, BAD_CAST "label",
+        "%s", BAD_CAST "");
+  } else {
+    label_x* label = nullptr;
+    LISTHEAD(context_->manifest_data.get()->label, label);
+    for (; label; label = label->next) {
+      xmlTextWriterStartElement(writer, BAD_CAST "label");
+      if (label->lang && strlen(label->lang)) {
+        xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+                                    BAD_CAST label->lang);
+      }
+      xmlTextWriterWriteString(writer, BAD_CAST label->name);
+      xmlTextWriterEndElement(writer);
+    }
+  }
+
+  if (!context_->manifest_data.get()->author) {
+    xmlTextWriterWriteFormatElement(writer, BAD_CAST "author",
+        "%s", BAD_CAST "");
+  } else {
+    author_x* author = nullptr;
+    LISTHEAD(context_->manifest_data.get()->author, author);
+    for (; author; author = author->next) {
+      xmlTextWriterStartElement(writer, BAD_CAST "author");
+      if (author->email && strlen(author->email)) {
+        xmlTextWriterWriteAttribute(writer, BAD_CAST "email",
+                                    BAD_CAST author->email);
+      }
+      if (author->href && strlen(author->href)) {
+        xmlTextWriterWriteAttribute(writer, BAD_CAST "href",
+                                    BAD_CAST author->href);
+      }
+      xmlTextWriterWriteString(writer, BAD_CAST author->text);
+      xmlTextWriterEndElement(writer);
+    }
+  }
+
   if (!context_->manifest_data.get()->description) {
     xmlTextWriterWriteFormatElement(writer, BAD_CAST "description",
         "%s", BAD_CAST "");
index 357d43c..791ed2d 100755 (executable)
@@ -121,6 +121,15 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) {
     LISTADD(manifest->uiapplication->label, label);
   }
 
+  author_x* author = reinterpret_cast<author_x*>(calloc(1, sizeof(author_x)));
+  if (!wgt_info->author().empty())
+    author->text = strdup(wgt_info->author().c_str());
+  if (!wgt_info->author_email().empty())
+    author->email = strdup(wgt_info->author_email().c_str());
+  if (!wgt_info->author_href().empty())
+    author->href = strdup(wgt_info->author_href().c_str());
+  LISTADD(manifest->author, author);
+
   return true;
 }