tizen beta release
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_desktop_file.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file    task_desktop_file.h
18  * @author  Pawel Sikorski (p.sikorski@samgsung.com)
19  * @version
20  * @brief
21  */
22
23 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H
24 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H
25
26 //SYSTEM INCLUDES
27 #include <fstream>
28
29 //WRT INCLUDES
30 #include <dpl/task.h>
31 #include <dpl/localization/localization_utils.h>
32
33 class InstallerContext;
34
35 namespace Jobs {
36 namespace WidgetInstall {
37 class TaskDesktopFile :
38     public DPL::TaskDecl<TaskDesktopFile>
39 {
40   public:
41     TaskDesktopFile(InstallerContext &inCont);
42     virtual ~TaskDesktopFile();
43
44   private:
45     //context data
46     InstallerContext &m_context;
47
48     //TODO stepAbort
49     //steps
50     void stepCreateDesktopFile();
51     void stepCreateExecFile();
52     void stepFinalize();
53     void stepCopyIconFiles();
54
55     //private data
56     std::ostringstream desktop_name;
57     std::ostringstream desktop_file;
58
59     //private methods
60     void moveDesktopFile();
61     void saveWidgetType(std::ofstream &file);
62     void saveWidgetExecPath(std::ofstream &file);
63     void saveWidgetName(std::ofstream &file);
64     void saveWidgetIcons(std::ofstream &file);
65     void saveWidgetVersion(std::ofstream &file);
66     void saveWidgetOtherInfo(std::ofstream &file);
67     void saveAppServiceInfo(std::ofstream &file);
68
69     static void saveLocalizedKey(std::ofstream &file,
70             const DPL::String& key,
71             const DPL::String& languageTag);
72     DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
73 };
74 } //namespace WidgetInstall
75 } //namespace Jobs
76
77 #endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DESKTOP_FILE_H */