1 /* |
|
2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This module contains the implementation of CSWInstUninstallRequest |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <SWInstTaskManager.h> |
|
22 |
|
23 #include "SWInstUninstallRequest.h" |
|
24 #include "SWInstUIPluginAPI.h" |
|
25 #include "SWInstServerPanic.h" |
|
26 |
|
27 using namespace SwiUI; |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CSWInstUninstallRequest::CSWInstUninstallRequest |
|
33 // C++ default constructor can NOT contain any code, that |
|
34 // might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CSWInstUninstallRequest::CSWInstUninstallRequest( const RMessage2& aMessage ) |
|
38 : CSWInstRequestObject( aMessage ) |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CSWInstUninstallRequest::CSWInstUninstallRequest |
|
44 // C++ default constructor can NOT contain any code, that |
|
45 // might leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CSWInstUninstallRequest::CSWInstUninstallRequest( TInt aObjectId ) |
|
49 : CSWInstRequestObject( aObjectId ) |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CSWInstUninstallRequest::ConstructL |
|
55 // Symbian 2nd phase constructor can leave. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 void CSWInstUninstallRequest::ConstructL() |
|
59 { |
|
60 BaseConstructL(); |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CSWInstUninstallRequest::NewL |
|
65 // Two-phased constructor. |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CSWInstUninstallRequest* CSWInstUninstallRequest::NewL( const RMessage2& aMessage ) |
|
69 { |
|
70 CSWInstUninstallRequest* self = |
|
71 new ( ELeave ) CSWInstUninstallRequest( aMessage ); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL(); |
|
74 CleanupStack::Pop( self ); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CSWInstUninstallRequest::NewL |
|
80 // Two-phased constructor. |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CSWInstUninstallRequest* CSWInstUninstallRequest::NewL( TInt aObjectId ) |
|
84 { |
|
85 CSWInstUninstallRequest* self = new ( ELeave ) CSWInstUninstallRequest( aObjectId ); |
|
86 CleanupStack::PushL( self ); |
|
87 self->ConstructL(); |
|
88 CleanupStack::Pop( self ); |
|
89 return self; |
|
90 } |
|
91 |
|
92 // Destructor |
|
93 CSWInstUninstallRequest::~CSWInstUninstallRequest() |
|
94 { |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CSWInstUninstallRequest::Uninstall |
|
99 // Perform uninstallation |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CSWInstUninstallRequest::Uninstall( const TUid& aUid, const TDesC8& aMIME ) |
|
104 { |
|
105 iIsSilent = EFalse; |
|
106 iUid = aUid; |
|
107 |
|
108 TRAPD( err, DoUninstallL( aMIME ) ); |
|
109 if ( err != KErrNone ) |
|
110 { |
|
111 CompleteSelf( err ); |
|
112 } |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CSWInstUninstallRequest::SilentInstall |
|
117 // Perform silent uninstallation |
|
118 // (other items were commented in a header). |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CSWInstUninstallRequest::SilentUninstall( const TUid& aUid, |
|
122 const TDesC8& aMIME, |
|
123 TUninstallOptions& aOptions ) |
|
124 { |
|
125 iIsSilent = ETrue; |
|
126 iUid = aUid; |
|
127 |
|
128 iOptions = aOptions; |
|
129 |
|
130 TRAPD( err, DoUninstallL( aMIME ) ); |
|
131 if ( err != KErrNone ) |
|
132 { |
|
133 CompleteSelf( err ); |
|
134 } |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CSWInstUninstallRequest::CustomUninstall |
|
139 // Perform a custom uninstallation. |
|
140 // (other items were commented in a header). |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 void CSWInstUninstallRequest::CustomUninstall( TOperation aOperation, |
|
144 const TDesC8& aParams, |
|
145 const TDesC8& aMIME ) |
|
146 { |
|
147 iIsSilent = EFalse; |
|
148 |
|
149 TRAPD( err, DoCustomUninstallL( aOperation, aParams, aMIME ) ); |
|
150 |
|
151 if ( err != KErrNone ) |
|
152 { |
|
153 CompleteSelf( err ); |
|
154 } |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CSWInstUninstallRequest::SilentCustomUninstall |
|
159 // Perform a custom uninstallation. |
|
160 // (other items were commented in a header). |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void CSWInstUninstallRequest::SilentCustomUninstall( TOperation aOperation, |
|
164 TUninstallOptions& aOptions, |
|
165 const TDesC8& aParams, |
|
166 const TDesC8& aMIME ) |
|
167 { |
|
168 iIsSilent = ETrue; |
|
169 |
|
170 TRAPD( err, DoSilentCustomUninstallL( aOperation, aOptions, aParams, aMIME ) ); |
|
171 |
|
172 if ( err != KErrNone ) |
|
173 { |
|
174 CompleteSelf( err ); |
|
175 } |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CSWInstUninstallRequest::CancelRequest |
|
180 // Cancels the current request. |
|
181 // (other items were commented in a header). |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void CSWInstUninstallRequest::CancelRequest() |
|
185 { |
|
186 // If we have a pending uninstall request, cancel it |
|
187 if ( iUIPlugin ) |
|
188 { |
|
189 iUIPlugin->Cancel(); |
|
190 } |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CSWInstUninstallRequest::RequestCompleteL |
|
195 // Gets called when the request is completed. |
|
196 // (other items were commented in a header). |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CSWInstUninstallRequest::RequestCompleteL( TInt aResult ) |
|
200 { |
|
201 // First see if we even have a ui plugin |
|
202 if ( iUIPlugin ) |
|
203 { |
|
204 // Run outstanding tasks |
|
205 TRAP_IGNORE( iTaskManager->ExecutePendingTasksL() ); |
|
206 |
|
207 // Inform the ui |
|
208 iUIPlugin->CompleteL(); |
|
209 |
|
210 // Delete the plugin and try to run outstanding tasks once again. |
|
211 delete iUIPlugin; |
|
212 iUIPlugin = NULL; |
|
213 TRAP_IGNORE( iTaskManager->ExecutePendingTasksL() ); |
|
214 } |
|
215 |
|
216 // Complete the client message |
|
217 Complete( aResult ); |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CSWInstUninstallRequest::DoUninstallL |
|
222 // Performs the actual uninstallation. |
|
223 // (other items were commented in a header). |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CSWInstUninstallRequest::DoUninstallL( const TDesC8& aMIME ) |
|
227 { |
|
228 __ASSERT_ALWAYS( iUid != TUid::Uid( 0 ), User::Leave( KErrBadDescriptor ) ); |
|
229 |
|
230 // Check that no other instances of installer are running |
|
231 LeaveIfInUseL(); |
|
232 |
|
233 // Try to recover in case of old fatal error |
|
234 TRAP_IGNORE( iTaskManager->ExecuteRecoveryTasksL() ); |
|
235 |
|
236 // Create the plugin based on the mime type |
|
237 CreatePluginL( aMIME ); |
|
238 |
|
239 if ( !iIsSilent ) |
|
240 { |
|
241 iUIPlugin->UninstallL( iUid, aMIME, iStatus ); |
|
242 } |
|
243 else |
|
244 { |
|
245 iUIPlugin->SilentUninstallL( iUid, aMIME, iOptions, iStatus ); |
|
246 } |
|
247 |
|
248 SetActive(); |
|
249 } |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CSWInstUninstallRequest::DoCustomUninstall |
|
253 // Perform a custom uninstallation. |
|
254 // (other items were commented in a header). |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CSWInstUninstallRequest::DoCustomUninstallL( TOperation aOperation, |
|
258 const TDesC8& aParams, |
|
259 const TDesC8& aMIME ) |
|
260 { |
|
261 // Check that no other instances of installer are running |
|
262 LeaveIfInUseL(); |
|
263 |
|
264 iTaskManager->ExecuteRecoveryTasksL(); |
|
265 |
|
266 // Create the plugin based on the mime type |
|
267 CreatePluginL( aMIME ); |
|
268 iUIPlugin->CustomUninstallL( aOperation, aParams, iStatus ); |
|
269 SetActive(); |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------------------------- |
|
273 // CSWInstUninstallRequest::DoSilentCustomUninstall |
|
274 // Perform a custom uninstallation. |
|
275 // (other items were commented in a header). |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 void CSWInstUninstallRequest::DoSilentCustomUninstallL( TOperation aOperation, |
|
279 TUninstallOptions& aOptions, |
|
280 const TDesC8& aParams, |
|
281 const TDesC8& aMIME ) |
|
282 { |
|
283 // Check that no other instances of installer are running |
|
284 LeaveIfInUseL(); |
|
285 |
|
286 iTaskManager->ExecuteRecoveryTasksL(); |
|
287 |
|
288 // Create the plugin based on the mime type |
|
289 CreatePluginL( aMIME ); |
|
290 iUIPlugin->SilentCustomUninstallL( aOperation, aOptions, aParams, iStatus ); |
|
291 SetActive(); |
|
292 } |
|
293 |
|
294 // End of File |
|