|
1 /* |
|
2 * Copyright (c) 2008-2009 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 the License "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: |
|
15 * This file implements the SifUtils library |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <usif/scr/scr.h> |
|
21 #include <usif/sts/sts.h> |
|
22 |
|
23 namespace Usif |
|
24 { |
|
25 EXPORT_C void UninstallL(TComponentId aComponentId) |
|
26 { |
|
27 // Connect to the SCR and start a transaction |
|
28 RSoftwareComponentRegistry scr; |
|
29 User::LeaveIfError(scr.Connect()); |
|
30 CleanupClosePushL(scr); |
|
31 scr.CreateTransactionL(); |
|
32 |
|
33 // Connect to the STS and start a transaction |
|
34 RStsSession sts; |
|
35 sts.CreateTransactionL(); |
|
36 CleanupClosePushL(sts); |
|
37 |
|
38 // Get a list of files to be deleted |
|
39 RSoftwareComponentRegistryFilesList fileList; |
|
40 fileList.OpenListL(scr, aComponentId); |
|
41 CleanupClosePushL(fileList); |
|
42 |
|
43 // Unregister and delete the files from iFileList |
|
44 HBufC* file = NULL; |
|
45 while ((file = fileList.NextFileL()) != NULL) |
|
46 { |
|
47 CleanupStack::PushL(file); |
|
48 sts.RemoveL(*file); |
|
49 CleanupStack::PopAndDestroy(file); |
|
50 } |
|
51 CleanupStack::PopAndDestroy(&fileList); |
|
52 |
|
53 // Delete the component from the SCR |
|
54 scr.DeleteComponentL(aComponentId); |
|
55 |
|
56 // Commit the STS & SCR transactions |
|
57 sts.CommitL(); |
|
58 scr.CommitTransactionL(); |
|
59 |
|
60 CleanupStack::PopAndDestroy(2, &scr); |
|
61 } |
|
62 } // namespace Usif |