|
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 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <featmgr/featurecontrol.h> |
|
20 |
|
21 // LOCAL CONSTANTS AND MACROS |
|
22 _LIT(KTxt,"featureuninstaller: mainL failed"); |
|
23 |
|
24 |
|
25 // ============================= LOCAL FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // mainL |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 LOCAL_C void mainL() |
|
32 { |
|
33 // Connect Feature Control |
|
34 RFeatureControl featureControl; |
|
35 User::LeaveIfError( featureControl.Open() ); |
|
36 |
|
37 // Example code disables an existing feature. |
|
38 // Comment or uncomment code when needed. |
|
39 |
|
40 // Specify in your .pkg file: |
|
41 // @"featureuninstaller.sisx", (0x10283304) |
|
42 |
|
43 //Replace UID 0x00000000 with real value |
|
44 TUid featureUid( TUid::Uid( 0x00000000 ) ); |
|
45 |
|
46 // Feature data is 32-bit quantity for client read and write. Feature data is |
|
47 // defined by owner of the feature and can contain for example flags, |
|
48 // enumeratons and/or integers. |
|
49 // Set feature data. Replace <featureData> with real value! |
|
50 // Uncomment when needed! |
|
51 // TUint32 featureData( 0x00000000 ); |
|
52 |
|
53 // Inform feature manager that your executable is launched by the software installer (SWI) |
|
54 // and it wishes to set, add, delete, enable or disable features in feature manager. This |
|
55 // function must be called before any API calls by RFeatureControl that add, set, delete |
|
56 // enable, or disable features so that changes in feature manager are cached to be rolled |
|
57 // back if the installationhas user-aborted or failed. Otherwise, feature manipulations will |
|
58 // be committed directly into feature manager and will not be possible to undo them in the |
|
59 // case of abort. |
|
60 // A call to SWIStart must be accompanied by a call to SWIEnd after all API calls by |
|
61 // RFeatureControl functions that manipulate features. |
|
62 User::LeaveIfError(featureControl.SWIStart()); |
|
63 |
|
64 // Disable an existing feature. |
|
65 User::LeaveIfError( featureControl.DisableFeature( featureUid ) ); |
|
66 |
|
67 // Inform feature manager that caching feature manipulations should stop and they should be |
|
68 // committed to feature manager. |
|
69 // A call to this API should follow the call to SWIStart before any RFeatureControl API calls |
|
70 // that manipulate features to feature manager. |
|
71 User::LeaveIfError(featureControl.SWIEnd()); |
|
72 |
|
73 // OR disable an exsiting feature and set feature data. |
|
74 // User::LeaveIfError( featureControl.SetFeature( featureUid, EFalse, featureData ) ); |
|
75 |
|
76 featureControl.Close(); |
|
77 } |
|
78 // ============================ MEMBER FUNCTIONS =============================== |
|
79 |
|
80 TInt E32Main() // main function called by E32 |
|
81 { |
|
82 __UHEAP_MARK; |
|
83 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack |
|
84 TRAPD( error,mainL() ); // Run main method |
|
85 __ASSERT_ALWAYS( !error,User::Panic(KTxt,error) ); |
|
86 delete cleanup; // destroy clean-up stack |
|
87 __UHEAP_MARKEND; |
|
88 return 0; // and return |
|
89 } |
|
90 |
|
91 |
|
92 // End of file |