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>
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();
66 void stepCopyIconFiles();
67 void stepCreateShortcut();
68 void stepGenerateManifest();
69 void stepParseManifest();
70 void stepParseUpgradedManifest();
73 void stepBackupIconFiles();
74 void stepUpdateFinalize();
76 void stepAbortIconFiles();
79 std::list<std::string> icon_list;
80 std::ostringstream backup_dir;
81 xmlTextWriterPtr writer;
82 DPL::String manifest_name;
83 DPL::String manifest_file;
88 void writeManifest(const DPL::String & path);
89 void validateManifest();
90 void commitManifest();
92 void setWidgetExecPath(UiApplication & uiApp);
93 void setWidgetName(Manifest & manifest, UiApplication & uiApp);
94 void setWidgetIcons(UiApplication & uiApp);
95 void setWidgetManifest(Manifest & manifest);
96 void setWidgetOtherInfo(UiApplication & uiApp);
97 void setAppServiceInfo(UiApplication & uiApp);
99 void generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved);
100 void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, int iconId, const WrtDB::WidgetDAOReadOnly::WidgetIconList & list, bool & defaultIconSaved);
103 void backupIconFiles();
104 void getFileList(const char* path, std::list<std::string> &list);
106 static void saveLocalizedKey(std::ofstream &file,
107 const DPL::String& key,
108 const DPL::String& languageTag);
109 DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
111 static const char * encoding;
114 } //namespace WidgetInstall
117 #endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H */