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