std::vector<SingleAccountInfo> accounts_;
};
+// TODO(t.iwanek): this structure should be unified for manifest handlers of
+// wgt and tpk packages
+struct ShortcutInfo {
+ std::string app_id;
+ std::string extra_data;
+ std::string extra_key;
+ std::string icon;
+ std::vector<std::pair<std::string, std::string>> labels;
+};
+
+using ShortcutListInfo = std::vector<ShortcutInfo>;
+
class ExtraManifestData {
public:
ExtraManifestData() {}
Property<AccountInfo> account_info;
+ Property<ShortcutListInfo> shortcut_info;
};
class BackendData {
xmlTextWriterEndElement(writer);
}
+ const auto& shortcuts =
+ context_->manifest_plugins_data.get().shortcut_info.get();
+ if (!shortcuts.empty()) {
+ xmlTextWriterStartElement(writer, BAD_CAST "shortcut-list");
+ for (auto& shortcut : shortcuts) {
+ xmlTextWriterStartElement(writer, BAD_CAST "shortcut");
+ if (!shortcut.app_id.empty())
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "appid",
+ BAD_CAST shortcut.app_id.c_str());
+ if (!shortcut.app_id.empty())
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "extra_data",
+ BAD_CAST shortcut.extra_data.c_str());
+ if (!shortcut.app_id.empty())
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "extra_key",
+ BAD_CAST shortcut.extra_key.c_str());
+ if (!shortcut.icon.empty()) {
+ xmlTextWriterStartElement(writer, BAD_CAST "icon");
+ xmlTextWriterWriteString(writer, BAD_CAST shortcut.icon.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+ for (auto& label : shortcut.labels) {
+ xmlTextWriterStartElement(writer, BAD_CAST "label");
+ if (!label.first.empty())
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST label.first.c_str());
+ xmlTextWriterWriteString(writer, BAD_CAST label.second.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+ xmlTextWriterEndElement(writer);
+ }
+ xmlTextWriterEndElement(writer);
+ }
+
xmlTextWriterEndElement(writer);
xmlTextWriterEndDocument(writer);
#include <tpk_manifest_handlers/package_handler.h>
#include <tpk_manifest_handlers/privileges_handler.h>
#include <tpk_manifest_handlers/service_application_handler.h>
+#include <tpk_manifest_handlers/shortcut_handler.h>
#include <tpk_manifest_handlers/ui_application_handler.h>
#include <manifest_parser/manifest_constants.h>
return true;
}
+bool StepParse::FillShortcuts() {
+ std::shared_ptr<const ShortcutListInfo> shortcut_info =
+ std::static_pointer_cast<const ShortcutListInfo>(parser_->GetManifestData(
+ app_keys::kShortcutListKey));
+ if (!shortcut_info)
+ return true;
+
+ common_installer::ShortcutListInfo list;
+ for (auto& shortcut : shortcut_info->shortcuts) {
+ common_installer::ShortcutInfo single_info;
+ single_info.app_id = shortcut.app_id;
+ single_info.extra_data = shortcut.extra_data;
+ single_info.extra_key = shortcut.extra_key;
+ single_info.icon = shortcut.icon;
+ single_info.labels = shortcut.labels;
+ list.push_back(single_info);
+ }
+ context_->manifest_plugins_data.get().shortcut_info.set(list);
+ return true;
+}
+
bool StepParse::FillManifestX(manifest_x* manifest) {
if (!FillPackageInfo(manifest))
return false;
return false;
if (!FillAccounts())
return false;
+ if (!FillShortcuts())
+ return false;
return true;
}