ec56d3d2552908c25802620af83ecef7260e3d99
[framework/web/wrt-installer.git] / src / jobs / job.cpp
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 #include <job.h>
17 #include <installer_controller.h>
18
19 namespace Jobs {
20 Job::Job(InstallationType installType) :
21     m_installationType(installType),
22     m_UndoType(false),
23     m_paused(false)
24 {}
25
26 InstallationType Job::GetInstallationType() const
27 {
28     return m_installationType;
29 }
30
31 bool Job::GetUndoType() const
32 {
33     return m_UndoType;
34 }
35
36 void Job::SetUndoType(bool flag)
37 {
38     m_UndoType = flag;
39 }
40
41 bool Job::IsPaused() const
42 {
43     return m_paused;
44 }
45
46 void Job::SetPaused(bool paused)
47 {
48     if (paused) {
49         Pause();
50     } else {
51         Resume();
52     }
53 }
54
55 void Job::Pause()
56 {
57     if (m_paused) {
58         return;
59     }
60
61     // Pause
62     m_paused = true;
63 }
64
65 void Job::Resume()
66 {
67     if (!m_paused) {
68         return;
69     }
70
71     // Continue
72     m_paused = false;
73
74     // Trigger next steps
75     CONTROLLER_POST_EVENT(Logic::InstallerController,
76                           InstallerControllerEvents::NextStepEvent(this));
77 }
78
79 void Job::SetJobHandle(JobHandle handle)
80 {
81     m_handle = handle;
82 }
83
84 JobHandle Job::GetJobHandle() const
85 {
86     return m_handle;
87 }
88
89 void Job::SendProgress()
90 {}
91
92 void Job::SendFinishedSuccess()
93 {}
94
95 void Job::SendFinishedFailure()
96 {}
97
98 void Job::SendProgressIconPath(const std::string &path)
99 {}
100
101 void Job::SaveExceptionData(const Jobs::JobExceptionBase&)
102 {}
103 } //namespace Jobs