2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file task_manifest_file.h
18 * @author Pawel Sikorski (p.sikorski@samgsung.com)
23 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H
24 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H
31 #include <dpl/localization/localization_utils.h>
32 #include <dpl/optional_typedefs.h>
34 #include <libxml2/libxml/xmlwriter.h>
36 #include <libxml_utils.h>
37 #include <widget_install/manifest.h>
38 #include <dpl/localization/localization_utils.h>
40 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
42 class InstallerContext;
45 namespace WidgetInstall {
46 class TaskManifestFile :
47 public DPL::TaskDecl<TaskManifestFile>
51 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
52 DECLARE_EXCEPTION_TYPE(Base, ManifestValidationError)
53 DECLARE_EXCEPTION_TYPE(Base, ManifestParsingError)
55 TaskManifestFile(InstallerContext &inCont);
56 virtual ~TaskManifestFile();
60 InstallerContext &m_context;
64 void stepCreateExecFile();
65 void stepCopyIconFiles();
66 void stepCopyLiveboxFiles();
67 void stepCopyAccountIconFiles();
68 #ifdef SERVICE_ENABLED
69 void stepCopyServiceIconFiles();
71 void stepGenerateManifest();
72 void stepCreateLinkNPPluginsFile();
74 void stepAbortParseManifest();
80 std::list<std::string> icon_list; //TODO: this should be registered as
82 std::ostringstream backup_dir;
83 xmlTextWriterPtr writer;
84 DPL::String manifest_name;
85 DPL::String manifest_file;
86 std::string commit_manifest;
90 void writeManifest(const DPL::String & path);
91 void commitManifest();
93 void setWidgetExecPath(UiApplication & uiApp,
94 const std::string &postfix = std::string());
95 void setWidgetName(Manifest & manifest,
96 UiApplication & uiApp);
97 void setWidgetIds(Manifest & manifest,
98 UiApplication & uiApp,
99 const std::string &postfix = std::string());
100 void setWidgetIcons(UiApplication & uiApp);
101 void setWidgetDescription(Manifest & manifest);
102 void setWidgetManifest(Manifest & manifest);
103 void setWidgetOtherInfo(UiApplication & uiApp);
104 void setAppControlsInfo(UiApplication & uiApp);
105 void setAppControlInfo(UiApplication & uiApp,
106 const WrtDB::ConfigParserData::AppControlInfo & service);
107 void setAppCategory(UiApplication & uiApp);
108 void setMetadata(UiApplication & uiApp);
109 void setLiveBoxInfo(Manifest& manifest);
110 void setAccount(Manifest& uiApp);
111 void setPrivilege(Manifest& manifest);
113 void generateWidgetName(Manifest & manifest,
114 UiApplication &uiApp,
115 const DPL::OptionalString& tag,
116 DPL::OptionalString name,
117 bool & defaultNameSaved);
118 void generateWidgetDescription(Manifest & manifest,
119 const DPL::OptionalString& tag,
120 DPL::OptionalString description);
121 void generateWidgetIcon(UiApplication & uiApp,
122 const DPL::OptionalString& tag,
123 const DPL::String& language, const std::string &extension,
124 bool isSmall, bool & defaultIconSaved);
125 void copyFile(const std::string& sourceFile,
126 const std::string& targetFile);
127 bool addBoxUiApplication(Manifest& manifest);
130 DPL::String getIconTargetFilename(const DPL::String& languageTag,
131 const std::string & ext) const;
133 static void saveLocalizedKey(std::ofstream &file,
134 const DPL::String& key,
135 const DPL::String& languageTag);
137 static const char * encoding;
140 void extractImeInfo(ImeApplication& imeApp);
141 void setWidgetNameIME(ImeApplication& imeApp);
142 void setWidgetIdsIME(ImeApplication& imeApp, const std::string& postfix = std::string());
143 void generateWidgetNameIME(ImeApplication& imeApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool& defaultNameSaved);
144 void setWidgetUuidIME(ImeApplication& imeApp);
145 void setWidgetLanguageIME(ImeApplication& imeApp);
146 void setWidgetTypeIME(ImeApplication& imeApp);
147 void setWidgetOptionIME(ImeApplication& imeApp);
150 #ifdef SERVICE_ENABLED
151 void setServiceInfo(ServiceApplication& serviceApp, WrtDB::ConfigParserData::ServiceAppInfo & service);
152 void setWidgetExecPathService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::ServiceAppInfo & service);
153 void setWidgetIdsService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::ServiceAppInfo & service);
154 void setWidgetNameService(ServiceApplication & serviceApp, WrtDB::ConfigParserData::ServiceAppInfo & service);
155 void setWidgetIconService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::ServiceAppInfo & service);
156 void setAppControlsInfoService(ServiceApplication & serviceApp);
157 void setAppControlInfoService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::AppControlInfo & service);
158 void setWidgetOtherInfoService(ServiceApplication & serviceApp);
159 void setWidgetComponentService(ServiceApplication & serviceApp);
160 void setWidgetAutoRestartService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::ServiceAppInfo & service);
161 void setWidgetOnBootService(ServiceApplication & serviceApp, const WrtDB::ConfigParserData::ServiceAppInfo & service);
164 } //namespace WidgetInstall
167 #endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H */