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>
33 #include <libxml2/libxml/xmlwriter.h>
35 #include <libxml_utils.h>
36 #include <widget_install/manifest.h>
37 #include <dpl/localization/localization_utils.h>
39 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
41 class InstallerContext;
44 namespace WidgetInstall {
45 class TaskManifestFile :
46 public DPL::TaskDecl<TaskManifestFile>
50 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
51 DECLARE_EXCEPTION_TYPE(Base, ManifestValidationError)
52 DECLARE_EXCEPTION_TYPE(Base, ManifestParsingError)
54 TaskManifestFile(InstallerContext &inCont);
55 virtual ~TaskManifestFile();
59 InstallerContext &m_context;
63 void stepCreateExecFile();
65 void stepCopyIconFiles();
66 void stepCopyLiveboxFiles();
67 void stepGenerateManifest();
68 void stepParseManifest();
69 void stepParseUpgradedManifest();
71 void stepAbortParseManifest();
74 void stepBackupIconFiles();
75 void stepUpdateFinalize();
77 void stepAbortIconFiles();
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;
89 void writeManifest(const DPL::String & path);
90 void commitManifest();
92 void setWidgetExecPath(UiApplication & uiApp,
93 const std::string &postfix = std::string());
94 void setWidgetName(Manifest & manifest,
95 UiApplication & uiApp);
96 void setWidgetIds(Manifest & manifest,
97 UiApplication & uiApp,
98 const std::string &postfix = std::string());
99 void setWidgetIcons(UiApplication & uiApp);
100 void setWidgetDescription(Manifest & manifest);
101 void setWidgetManifest(Manifest & manifest);
102 void setWidgetOtherInfo(UiApplication & uiApp);
103 void setAppControlsInfo(UiApplication & uiApp);
104 void setAppControlInfo(UiApplication & uiApp,
105 const WrtDB::ConfigParserData::AppControlInfo & service);
106 void setAppCategory(UiApplication & uiApp);
107 void setMetadata(UiApplication & uiApp);
108 void setLiveBoxInfo(Manifest& manifest);
109 void setAccount(Manifest& uiApp);
110 void setPrivilege(Manifest& manifest);
112 void generateWidgetName(Manifest & manifest,
113 UiApplication &uiApp,
114 const DPL::OptionalString& tag,
115 DPL::OptionalString name,
116 bool & defaultNameSaved);
117 void generateWidgetDescription(Manifest & manifest,
118 const DPL::OptionalString& tag,
119 DPL::OptionalString description);
120 void generateWidgetIcon(UiApplication & uiApp,
121 const DPL::OptionalString& tag,
122 const DPL::String& language,
123 bool & defaultIconSaved);
126 void backupIconFiles();
127 void getFileList(const char* path, std::list<std::string> &list);
128 DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
130 static void saveLocalizedKey(std::ofstream &file,
131 const DPL::String& key,
132 const DPL::String& languageTag);
134 static const char * encoding;
136 } //namespace WidgetInstall
139 #endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H */