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