testexecfw/stf/stfext/testlibplugins/syslibplugin/src/AppInstall.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 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 "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: This file contains the header file of the CAtsLogger 
       
    15 * class.
       
    16 *
       
    17 */
       
    18 #include <e32base.h>
       
    19 #include <e32cons.h>
       
    20 #include <hal.h>
       
    21 
       
    22 
       
    23 // Epoc Includes
       
    24 #include <swi/launcher.h>
       
    25 
       
    26 
       
    27 #include "appinstall.h"
       
    28 #include "testsecurityinstuihandler.h"
       
    29 
       
    30 
       
    31 CAppInstall::CAppInstall()
       
    32 	{
       
    33 	}
       
    34 
       
    35 TInt CAppInstall::Install(const TDesC& aFileName)
       
    36 	{
       
    37 	
       
    38 	TInt error = KErrNone;
       
    39 
       
    40 	TFileName fileName(aFileName);
       
    41 	
       
    42 	fileName.PtrZ();	
       
    43 	
       
    44 	Swi::CInstallPrefs* iInstallPrefs = Swi::CInstallPrefs::NewL();
       
    45 	
       
    46 	CTestSecurityInstUIHandler* iUIHandler = CTestSecurityInstUIHandler::NewL();
       
    47 	
       
    48 	error = Swi::Launcher::Install(*iUIHandler,fileName,*iInstallPrefs);
       
    49 
       
    50 	delete iUIHandler;
       
    51 	delete iInstallPrefs;
       
    52 	
       
    53 	return error;
       
    54 	
       
    55 	}
       
    56 
       
    57 TInt CAppInstall::Uninstall(const TDesC& aUid)
       
    58 	{
       
    59 	
       
    60 	TInt error = KErrNone;
       
    61 
       
    62 	TLex conv(aUid);
       
    63 	
       
    64 	TUint32 id;
       
    65 	
       
    66 	error = conv.Val(id,EHex);
       
    67 	
       
    68 	if(error!=KErrNone)
       
    69 		{
       
    70 		return error;
       
    71 		}
       
    72 		
       
    73 	TUid uid = TUid::Uid(id);
       
    74 		
       
    75 	
       
    76 	CTestSecurityInstUIHandler* iUIHandler = CTestSecurityInstUIHandler::NewL();
       
    77 
       
    78 	error = Swi::Launcher::Uninstall(*iUIHandler, uid);
       
    79 	
       
    80 	delete iUIHandler;
       
    81 
       
    82 	return error;
       
    83 		
       
    84 	}
       
    85