|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "ssmcommandparameters.h" |
|
17 |
|
18 #include "cmdstartapp.h" |
|
19 #include "ssmdebug.h" |
|
20 #include "ssmpanic.h" |
|
21 |
|
22 /** |
|
23 Used to create an instance of CCmdStartApp class from a read stream. |
|
24 CSsmCommandList::InternalizeL() uses this method to construct a command from stream. |
|
25 |
|
26 @param aReadStream Read stream containing data through which object can be created |
|
27 @return A pointer to an object of type CCmdStartApp. |
|
28 */ |
|
29 CCmdStartApp* CCmdStartApp::NewL(RReadStream& aReadStream) |
|
30 { |
|
31 CCmdStartApp* self = new (ELeave) CCmdStartApp(); |
|
32 CleanupStack::PushL(self); |
|
33 self->ConstructL(aReadStream); |
|
34 CleanupStack::Pop(self); |
|
35 return self; |
|
36 } |
|
37 |
|
38 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
39 /** |
|
40 Used to create an instance of CCmdStartApp class from given parameters. |
|
41 This method is used by SsmCommandFactory to create a command. |
|
42 |
|
43 @param aSeverity The severity of the command |
|
44 @param aAppInfo Contains information which can be used to start the process |
|
45 @param aPriority The priority of the command in the list |
|
46 @panic ECmdNullPtr if the information used to create command is null |
|
47 @return A pointer to an object of type CCmdStartApp. |
|
48 */ |
|
49 CCmdStartApp* CCmdStartApp::NewL(TCmdErrorSeverity aSeverity, const CSsmStartupProperties *aAppInfo, const TUint16 aPriority) |
|
50 { |
|
51 __ASSERT_ALWAYS(aAppInfo != NULL, PanicNow(KPanicCmdStartApp, ECmdNullPtr)); |
|
52 CCmdStartApp* self = new (ELeave) CCmdStartApp(aSeverity, aPriority); |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(aAppInfo); |
|
55 CleanupStack::Pop(self); |
|
56 return self; |
|
57 } |
|
58 #endif |
|
59 |
|
60 /** |
|
61 Used to create an instance of CCmdStartApp class from given parameters. |
|
62 This method is used by SsmCommandFactory to create a command. |
|
63 |
|
64 @param aSeverity The severity of the command |
|
65 @param aAppInfo Contains information which can be used to start the process |
|
66 @panic ECmdNullPtr if the information used to create command is null |
|
67 @return A pointer to an object of type CCmdStartApp. |
|
68 */ |
|
69 CCmdStartApp* CCmdStartApp::NewL(TCmdErrorSeverity aSeverity, const CSsmStartupProperties *aAppInfo) |
|
70 { |
|
71 __ASSERT_ALWAYS(aAppInfo != NULL, PanicNow(KPanicCmdStartApp, ECmdNullPtr)); |
|
72 CCmdStartApp* self = new (ELeave) CCmdStartApp(aSeverity); |
|
73 CleanupStack::PushL(self); |
|
74 self->ConstructL(aAppInfo); |
|
75 CleanupStack::Pop(self); |
|
76 return self; |
|
77 } |
|
78 |
|
79 /** |
|
80 Used to create an instance of CCmdStartApp class from resource. |
|
81 |
|
82 @param aCommandParameters Object data from a resource file |
|
83 @return A pointer to an object of type CCmdStartApp. |
|
84 */ |
|
85 CCmdStartApp* CCmdStartApp::NewL(TSsmCommandParameters& aCommandParameters) |
|
86 { |
|
87 CCmdStartApp* self = new (ELeave) CCmdStartApp(); |
|
88 CleanupStack::PushL(self); |
|
89 self->ConstructL(aCommandParameters); |
|
90 CleanupStack::Pop(self); |
|
91 return self; |
|
92 } |
|
93 |
|
94 /** |
|
95 Used to create an instance of CCmdStartApp class from CCmdStartApp object |
|
96 Must be used only by CLE |
|
97 @param aCmdStartApp CCmdStartApp reference |
|
98 @param aUtilProvider CSsmCommandUtilProvider reference |
|
99 @return A pointer to an object of type CCmdStartApp. |
|
100 */ |
|
101 CCmdStartApp* CCmdStartApp::NewLC(const CCmdStartApp& aCmdStartApp, CSsmCommandUtilProvider* aUtilProvider) |
|
102 { |
|
103 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
104 CCmdStartApp* self = new (ELeave) CCmdStartApp(aCmdStartApp.Severity(),aCmdStartApp.Priority()); |
|
105 #else |
|
106 CCmdStartApp* self = new (ELeave) CCmdStartApp(aCmdStartApp.Severity()); |
|
107 #endif |
|
108 CleanupStack::PushL(self); |
|
109 self->ConstructL(aCmdStartApp, aUtilProvider); |
|
110 return self; |
|
111 } |
|
112 |
|
113 void CCmdStartApp::ConstructL(const CCmdStartApp& aCmdStartApp, CSsmCommandUtilProvider* aUtilProvider) |
|
114 { |
|
115 iConditionalResourceId = aCmdStartApp.ConditionalInformation(); |
|
116 SetUtilProvider(*aUtilProvider); |
|
117 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
118 if (iConditionalResourceId != 0) |
|
119 { |
|
120 SetCommandResourceFileNameL(aCmdStartApp.GetCommandResourceFileName()); |
|
121 } |
|
122 #endif |
|
123 CCmdStarterBase::ConstructL(aCmdStartApp.AppInfo(),FALSE); |
|
124 } |
|
125 |
|
126 /** |
|
127 Returns the version of the BIC |
|
128 @return The maximum supported version of the BIC |
|
129 */ |
|
130 TInt CCmdStartApp::MaxSupportedVersion() |
|
131 { |
|
132 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
133 return (static_cast<TInt>(ECmdStartAppVersionWithPriority)); |
|
134 #else |
|
135 return (static_cast<TInt>(ECmdStartAppInitialVersion)); |
|
136 #endif |
|
137 } |
|
138 |
|
139 /** |
|
140 Destructor |
|
141 */ |
|
142 CCmdStartApp::~CCmdStartApp() |
|
143 { |
|
144 } |
|
145 |
|
146 /** |
|
147 Overloaded constructor. |
|
148 */ |
|
149 CCmdStartApp::CCmdStartApp() |
|
150 : CCmdStarterBase(ESsmCmdStartApp) |
|
151 { |
|
152 } |
|
153 |
|
154 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
155 /** |
|
156 Overloaded constructor |
|
157 @param aSeverity Severity of command |
|
158 @param aPriority The priority of the command in the list |
|
159 */ |
|
160 CCmdStartApp::CCmdStartApp(TCmdErrorSeverity aSeverity, const TUint16 aPriority) |
|
161 : CCmdStarterBase(ESsmCmdStartApp, aSeverity, aPriority) |
|
162 { |
|
163 } |
|
164 #endif |
|
165 |
|
166 |
|
167 /** |
|
168 Overloaded constructor |
|
169 @param aSeverity Severity of command |
|
170 */ |
|
171 CCmdStartApp::CCmdStartApp(TCmdErrorSeverity aSeverity) |
|
172 : CCmdStarterBase(ESsmCmdStartApp, aSeverity) |
|
173 { |
|
174 } |
|
175 |
|
176 /** |
|
177 Constructs an object from resource file. |
|
178 @param aCommandParameters Object data from a resource file |
|
179 */ |
|
180 void CCmdStartApp::ConstructL(TSsmCommandParameters& aCommandParameters) |
|
181 { |
|
182 RResourceReader& reader = aCommandParameters.MainReader(); |
|
183 const TSsmCommandType type = static_cast<TSsmCommandType>(reader.ReadInt16L()); |
|
184 SSMLOGLEAVEIFFALSE(type == Type(), KErrNotSupported); |
|
185 const TInt version = reader.ReadInt16L(); |
|
186 SSMLOGLEAVEIFFALSE(__COMPARE_VERSION(version, CCmdStartApp::MaxSupportedVersion()), KErrNotSupported); |
|
187 CCmdStarterBase::ConstructL(aCommandParameters); |
|
188 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE |
|
189 iPriority = (version > ECmdStartAppInitialVersion)? reader.ReadUint16L() : KDefaultCommandPriority ; |
|
190 #endif |
|
191 } |
|
192 |
|
193 /** |
|
194 Configures the BIC using data contained in a ReadStream |
|
195 @param aReadStream A read stream containing BIC data |
|
196 */ |
|
197 void CCmdStartApp::ConstructL(RReadStream& aReadStream) |
|
198 { |
|
199 CCmdStarterBase::ConstructL(aReadStream); |
|
200 } |
|
201 |
|
202 /** |
|
203 Constructs an object from aAppInfo. |
|
204 @param aAppInfo Startup properties through which command will be constructed. |
|
205 */ |
|
206 void CCmdStartApp::ConstructL(const CSsmStartupProperties *aAppInfo) |
|
207 { |
|
208 CCmdStarterBase::ConstructL(aAppInfo); |
|
209 } |
|
210 |