contentstorage/tsrc/testutils/inc/t_cainstaller.h
author Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
Thu, 16 Sep 2010 12:11:40 +0100
changeset 117 c63ee96dbe5f
permissions -rw-r--r--
Missing activityfw and taskswitcher components - fix for Bug 3670

/*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:  ?Description
 *
 */

#ifndef T_CA_INSTALLER_H
#define T_CA_INSTALLER_H

#include <e32base.h>
#include <f32file.h>
#include <usif/sif/sif.h>
#include <usif/scr/scr.h>

/**
 * Installer 
 *
 */
NONSHARABLE_CLASS(T_CaInstaller): public CActive {

public:
    /**
    * Destructor
    */
    virtual ~T_CaInstaller();
    
    /**
     * Two-phased constructor. Leaves on failure.
     * Allocates memory for and constructs an uninstaller object. After that
     * starts asynchronous uninnstallation of the requested entry
     * @param aFileName name of the file to be installed
     * @param aPriority priority of the active scheduler responsible for handling
     * asynchronous installation operation
     * @return The constructed object.
     */
    static T_CaInstaller *NewL( TInt aPriority =
            CActive::EPriorityStandard );
    
    /**
     * Starts asynchronous installation operation
     * @param aFileName name of the file to be installed
     * @param aComponentId placeholder for component id of the package after
     * instalation is completed.
     */
    void InstallL(const TDesC& aFileName);
        /**
     * Uninstall operation
     * @param aComponentId id of the component to be installed.
     */
    void UninstallL( Usif::TComponentId aComponentId );
    
    /**
     * Uninstall operation for package(s) based on filename
     * for native and HS widgets.
     * @param aFileName the file name installed with the package(s)
     */ 
    void UninstallL( const TDesC& aFileName );

    /**
     * Uninstall operation for java applications
     * @param aUid ui
     */ 
    void UninstallL(TUint32 aUid);
    
    /**
     * Find component id for a file name
     * @param aFileName the file name installed with the package(s)
     * @return componentId for a requested file name
     */ 
    Usif::TComponentId GetComponentIdL( const TDesC& aFileName );
    
    /**
     * Find component id for a uid
     * @param aUid ui
     * @return componentId for a requested uid
     */ 
    Usif::TComponentId GetComponentIdL( TInt32 aUid );
    
    /**
     * Find component id for CWRT app id
     * @param aAppId CWRT widget app id
     * @return componentId for a requested uid
     */ 
    Usif::TComponentId  GetComponentIdForAppIdL( const TDesC& aAppId);
private:
    // construction
    /**
     * Constructor.
     * Starts active scheduler.
     * @param aPriority priority of the active scheduler responsible for handling
     * asynchronous installation operation
     */
    T_CaInstaller(TInt aPriority);
    
    /**
     * Initializes the object and starts asynchronous uninstallation process.
     */
    void ConstructL();
    


private:
    // from CActive

    void RunL();
    void DoCancel();
    TInt RunError( TInt aError );

private:
    Usif::COpaqueNamedParams* iArguments;
    Usif::COpaqueNamedParams* iResults;
    RFs iFs;
    Usif::RSoftwareInstall iInstaller;
    Usif::RSoftwareComponentRegistry iSoftwareRegistry;
    CActiveSchedulerWait   iSchedulerWait;
};

#endif // T_CA_INSTALLER_H