tizen beta release
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_widget_config.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_widget_config.cpp
18  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
19  * @version 1.0
20  * @brief   Implementation file for installer task widget config
21  */
22 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
23 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
24
25 #include <WidgetConfigurationManager.h>
26 #include <dpl/task.h>
27 #include <dpl/task_list.h>
28 #include <dpl/string.h>
29 #include <dpl/event/nested_loop.h>
30 #include <wrt_error.h>
31 #include <dpl/wrt-dao-ro/global_config.h>
32 #include <set>
33 #include <dpl/popup/popup_controller.h>
34 #include <dpl/popup/popup_manager.h>
35 #include <dpl/popup/popup_renderer.h>
36 #include <wrt_common_types.h>
37
38 class InstallerContext;
39
40 namespace Jobs {
41 namespace WidgetInstall {
42 namespace InstallerTaskWidgetPopupData {
43 struct PopupData
44 {
45     DPL::String widgetInfo;
46     void addWidgetInfo(const DPL::String &head,
47             const DPL::String &info);
48 };
49 } // InstalllerTaskWidgetPopupData
50
51 class TaskWidgetConfig :
52     public DPL::TaskDecl<TaskWidgetConfig>,
53     public DPL::Popup::PopupControllerUser
54 {
55   private:
56     enum PowderInfoButton
57     {
58         WRT_POPUP_BUTTON_OK, WRT_POPUP_BUTTON_CANCEL
59     };
60
61     InstallerContext& m_installContext;
62     WrtDB::LocaleSet m_localeFolders;
63     std::set<DPL::String> m_processedIconSet;
64     bool m_installCancel;
65     InstallerTaskWidgetPopupData::PopupData m_popupData;
66
67     void StepProcessConfigurationFile();
68     void ReadLocaleFolders();
69     void ProcessLocalizedStartFiles();
70     void ProcessStartFile(const DPL::OptionalString& path,
71             const DPL::OptionalString& type,
72             const DPL::OptionalString& encoding = DPL::OptionalString::Null,
73             bool typeForcedInConfig = false);
74     void ProcessLocalizedIcons();
75     void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
76     void StepProcessPowderFile();
77     void StepVerifyFeatures();
78     void StepShowWidgetInfo();
79     void StepPowderCancel();
80     void StepFeatureCancel();
81     void StepCancelWidgetInstallation();
82     void StepShowPowderPassword();
83     void StepShowPowderPasswordCancel();
84     void PopupCreate();
85     DPL::String createPowderInfo() const;
86     void AnswerCallback(const DPL::Popup::AnswerCallbackData& answer);
87     DPL::String createAuthorWidgetInfo() const;
88     void setApplicationType();
89     bool isFeatureAllowed(
90             WrtDB::AppType appType, DPL::String featureName);
91
92   public:
93     TaskWidgetConfig(InstallerContext& installTaskContext);
94 };
95 } //namespace WidgetInstall
96 } //namespace Jobs
97
98 #endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H