os/persistentdata/featuremgmt/featuremgr/tools/featureuninstaller/featureuninstaller.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/featuremgmt/featuremgr/tools/featureuninstaller/featureuninstaller.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +// INCLUDE FILES
    1.22 +#include <featmgr/featurecontrol.h>
    1.23 +
    1.24 +// LOCAL CONSTANTS AND MACROS
    1.25 +_LIT(KTxt,"featureuninstaller: mainL failed");
    1.26 +
    1.27 +
    1.28 +// ============================= LOCAL FUNCTIONS ===============================
    1.29 +
    1.30 +// -----------------------------------------------------------------------------
    1.31 +// mainL
    1.32 +// -----------------------------------------------------------------------------
    1.33 +//  
    1.34 +LOCAL_C void mainL()
    1.35 +	{
    1.36 +	// Connect Feature Control
    1.37 +	RFeatureControl featureControl;
    1.38 +    User::LeaveIfError( featureControl.Open() );
    1.39 +    
    1.40 +    // Example code disables an existing feature.
    1.41 +    // Comment or uncomment code when needed. 
    1.42 +    
    1.43 +    // Specify in your .pkg file:
    1.44 +    // @"featureuninstaller.sisx", (0x10283304)
    1.45 +    
    1.46 +    //Replace UID 0x00000000 with real value
    1.47 +	TUid featureUid( TUid::Uid( 0x00000000 ) ); 
    1.48 +	
    1.49 +    // Feature data is 32-bit quantity for client read and write. Feature data is
    1.50 +    // defined by owner of the feature and can contain for example flags, 
    1.51 +    // enumeratons and/or integers.
    1.52 +    // Set feature data. Replace <featureData> with real value!
    1.53 +    // Uncomment when needed!
    1.54 +    // TUint32 featureData( 0x00000000 );
    1.55 +    
    1.56 +	// Inform feature manager that your executable is launched by the software installer (SWI)
    1.57 +    // and it wishes to set, add, delete, enable or disable features in feature manager. This
    1.58 +    // function must be called before any API calls by RFeatureControl that add, set, delete 
    1.59 +    // enable, or disable features so that changes in feature manager are cached to be rolled 
    1.60 +    // back if the installationhas user-aborted or failed. Otherwise, feature manipulations will
    1.61 +    // be committed directly into feature manager and will not be possible to undo them in the
    1.62 +    // case of abort.
    1.63 +    // A call to SWIStart must be accompanied by a call to SWIEnd after all API calls by
    1.64 +    // RFeatureControl functions that manipulate features.
    1.65 +	User::LeaveIfError(featureControl.SWIStart()); 
    1.66 +
    1.67 +    // Disable an existing feature.
    1.68 +    User::LeaveIfError( featureControl.DisableFeature( featureUid ) );
    1.69 +    
    1.70 +    // Inform feature manager that caching feature manipulations should stop and they should be 
    1.71 +    // committed to feature manager.
    1.72 +    // A call to this API should follow the call to SWIStart before any RFeatureControl API calls
    1.73 +    // that manipulate features to feature manager.
    1.74 +    User::LeaveIfError(featureControl.SWIEnd());
    1.75 +    
    1.76 +    // OR disable an exsiting feature and set feature data.
    1.77 +    // User::LeaveIfError( featureControl.SetFeature( featureUid, EFalse, featureData ) );
    1.78 +    
    1.79 +    featureControl.Close();
    1.80 +    }
    1.81 +// ============================ MEMBER FUNCTIONS ===============================
    1.82 +
    1.83 +TInt E32Main() // main function called by E32
    1.84 +	{
    1.85 +	__UHEAP_MARK;
    1.86 +	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
    1.87 +	TRAPD( error,mainL() ); // Run main method
    1.88 +	__ASSERT_ALWAYS( !error,User::Panic(KTxt,error) );
    1.89 +	delete cleanup; // destroy clean-up stack
    1.90 +	__UHEAP_MARKEND;
    1.91 +	return 0; // and return
    1.92 +	}
    1.93 +
    1.94 +
    1.95 +// End of file