|
1 /* |
|
2 * Copyright (c) 2008-2010 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 #include "sifutils.h" |
|
23 #include "scr_internal.h" |
|
24 |
|
25 EXPORT_C void Usif::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 // Connect to the STS and start a transaction |
|
33 RStsSession sts; |
|
34 sts.CreateTransactionL(); |
|
35 CleanupClosePushL(sts); |
|
36 // Get a list of files to be deleted |
|
37 RSoftwareComponentRegistryFilesList fileList; |
|
38 fileList.OpenListL(scr, aComponentId); |
|
39 CleanupClosePushL(fileList); |
|
40 // Unregister and delete the files from iFileList |
|
41 HBufC* file = NULL; |
|
42 while ((file = fileList.NextFileL()) != NULL) |
|
43 { |
|
44 CleanupStack::PushL(file); |
|
45 sts.RemoveL(*file); |
|
46 CleanupStack::PopAndDestroy(file); |
|
47 } |
|
48 CleanupStack::PopAndDestroy(&fileList); |
|
49 |
|
50 // Delete the component from the SCR |
|
51 scr.DeleteComponentL(aComponentId); |
|
52 |
|
53 // Commit the STS & SCR transactions |
|
54 sts.CommitL(); |
|
55 scr.CommitTransactionL(); |
|
56 CleanupStack::PopAndDestroy(2, &scr); |
|
57 } |
|
58 |
|
59 EXPORT_C TUid Usif::GenerateNewAppUidL() |
|
60 { |
|
61 // Connect to SCR using the internal client. |
|
62 RScrInternalClient scr; |
|
63 User::LeaveIfError(scr.Connect()); |
|
64 CleanupClosePushL(scr); |
|
65 |
|
66 //Request for an unused UID. |
|
67 TUid generatedUid = scr.GenerateNewAppUidL(); |
|
68 |
|
69 CleanupStack::PopAndDestroy(&scr); |
|
70 return generatedUid; |
|
71 } |
|
72 |
|
73 |