epoc32/include/mw/swi/pkgremover.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/swi/pkgremover.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Interface class for listing/removing uninstalled packages from a removable drive
    15 // 
    16 //
    17 
    18 
    19 
    20 /**
    21  @file 
    22  @publishedAll
    23  @released
    24 */
    25 
    26 #ifndef __PKGREMOVER_H__
    27 #define __PKGREMOVER_H__
    28 
    29 #include <e32base.h>
    30 #include <f32fsys.h>
    31 #include <s32mem.h>
    32 
    33 namespace Swi
    34 {
    35 
    36 class CUninstalledPackageEntry;
    37 
    38 
    39 /**
    40  * This class provides static methods for managing uninstalled native packages
    41  * (SIS files) that are taking up space on removable drives.
    42  *
    43  * @publishedAll
    44  * @released
    45  */
    46 
    47 NONSHARABLE_CLASS(UninstalledSisPackages)
    48 {
    49 public:
    50 
    51 	/**
    52 	 * Get the list of uninstalled packages on a specified removable drive. In
    53 	 * this context uninstalled means 'not known by this phone'. This will list
    54 	 * uninstalled PA & PP files found in the SWI Daemon's private directory, and
    55 	 * will also search the sis registry files on the drive for uninstalled
    56 	 * applications.
    57 	 *
    58 	 * @param aDrive    		Removable drive number (@see TDriveNumber)
    59 	 * @param aPackageList      Array of pointers to the uninstalled packages
    60 	 *							found on the specified drive (@see
    61 	 *                          CUninstalledPackageEntry). This array is assumed to be empty.
    62 	 *							The caller takes ownership of the elements added to the array.
    63 	 * @leave					One of the system-wide error codes.
    64 	 * @leave                   KErrNotRemovable If the drive is not removable or is substed
    65 	 * @leave					KErrPackageFileCorrupt If an error occurs during the processing of files
    66 	 * @capability              ReadDeviceData Required to access protected directories during listing operation
    67 	 * @capability              ProtServ Required to access services of software installer
    68 	 * @capability             	TrustedUI Required to access services of software installer
    69 	 */
    70 	IMPORT_C static void ListL(TDriveNumber aDrive, RPointerArray<CUninstalledPackageEntry>& aPackageList);
    71 
    72 	/**
    73 	 * Remove the specified uninstalled package. The following restrictions apply to the files that will be removed:
    74 	 * <ul>
    75 	 * <li> For security reasons only files on the same drive as the package controller will be removed. Files on other drives will be orphaned.
    76 	 * <li> Files belonging to other packages will not be removed.
    77 	 * </ul>
    78 	 *
    79 	 * @param aPackage			The uninstalled package to remove (@see CUninstalledPackageEntry)
    80 	 * @leave					One of the system-wide error codes.
    81 	 * @leave                   KErrNotRemovable If the drive is not removable or is substed
    82 	 * @leave					KErrPackageIsInstalled If the specified package is installed on the device
    83 	 * @leave					KErrPackageFileCorrupt If an error occurs during the processing of files
    84 	 * @capability				WriteDeviceData Required to write to protected directories during remove operation
    85 	 * @capability				ProtServ Required to access services of software installer
    86 	 * @capability				TrustedUI Required to access services of software installer
    87 	 */
    88 	IMPORT_C static void RemoveL(const CUninstalledPackageEntry& aPackage);
    89 };
    90 
    91 
    92 /**
    93  * Uninstalled application entry class.
    94  *
    95  * This class is not externally instantiable. It is returned as a result of 
    96  * querying for a list of uninstalled packages present on a removable drive. 
    97  * Each object of this type represents one uninstalled package. Methods can 
    98  * be called on this object to retrieve the package details such as 
    99  * Package UID, Name, Vendor, Version and Type.
   100  *
   101  * @publishedAll
   102  * @released
   103  */
   104 
   105 NONSHARABLE_CLASS(CUninstalledPackageEntry) : public CBase
   106 {
   107 public:
   108 	enum TPackageType
   109 	{
   110 	    ESaPackage,       ///< Standard Application
   111 		ESpPackage,       ///< Standard Patch (augmentation)
   112 		EPuPackage,       ///< Partial Upgrade
   113 		EPaPackage,       ///< Preinstalled Application
   114 		EPpPackage        ///< Preinstalled Patch
   115 	};
   116 
   117 	/**
   118 	 * Get the package Uid
   119 	 *
   120 	 * @return The Uid of this package
   121 	 */
   122 	IMPORT_C const TUid& Uid() const;
   123 
   124 	/**
   125 	 * Get the package name
   126 	 *
   127 	 * @return The name of this package as reference to TDesC
   128 	 */
   129 	IMPORT_C const TDesC& Name() const;
   130 
   131 	/**
   132 	 * Get the package unique vendor name
   133 	 *
   134 	 * @return The unique vendor name of this package as reference to TDesC
   135 	 */
   136 	IMPORT_C const TDesC& Vendor() const;
   137 
   138 	/**
   139 	 * Get the package version
   140 	 *
   141 	 * @return The version number of this package
   142 	 */
   143 	IMPORT_C const TVersion& Version() const;
   144 
   145 	/**
   146 	 * Get the package type
   147 	 *
   148 	 * @return The package type of this package
   149 	 */
   150 	IMPORT_C const TPackageType& PackageType() const;
   151 
   152 	/**
   153 	* Destructor
   154 	*/
   155 	virtual ~CUninstalledPackageEntry();
   156 
   157 private:
   158 	static CUninstalledPackageEntry* NewLC(const TUid& aUid, const TDesC& aPackageName,
   159 		const TDesC& aVendorName, const TVersion& aVersion, const TPackageType aPackageType,
   160 		const TDesC& aPackageFile, const TDesC& aAssocStubSisFile);
   161 
   162 private:
   163 	CUninstalledPackageEntry();
   164 
   165 private:
   166 	void ConstructL(const TUid& aUid, const TDesC& aPackageName, const TDesC& aVendorName, 
   167 		const TVersion& aVersion, const TPackageType aPackageType, const TDesC& aPackageFile,
   168 		const TDesC& aAssocStubSisFile);
   169 
   170 	const TDesC& PackageFile() const;
   171 	const TDesC& AssociatedStubSisFile() const;
   172 
   173 private:
   174 	/// The package Uid
   175 	TUid iUid;
   176 
   177     /// The package name
   178 	HBufC* iPackageName;
   179 
   180     /// The package unique vendor name
   181 	HBufC* iVendorName;
   182 
   183     /// The package version
   184 	TVersion iVersion; 
   185 
   186 	/// The package type
   187 	TPackageType iType;
   188 
   189 	// The sis/controller file name with full path
   190 	HBufC* iPackageFile;
   191 
   192 	// The stub sis file name with full path (if the package file is a controller file)
   193 	HBufC* iAssocStubSisFile;
   194 private:
   195 	friend class UninstalledSisPackages;
   196 };
   197 
   198 } // namespace Swi
   199 
   200 #endif // __PKGREMOVER_H__