1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/swi/pkgremover.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,200 @@
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 +// Interface class for listing/removing uninstalled packages from a removable drive
1.18 +//
1.19 +//
1.20 +
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedAll
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __PKGREMOVER_H__
1.30 +#define __PKGREMOVER_H__
1.31 +
1.32 +#include <e32base.h>
1.33 +#include <f32fsys.h>
1.34 +#include <s32mem.h>
1.35 +
1.36 +namespace Swi
1.37 +{
1.38 +
1.39 +class CUninstalledPackageEntry;
1.40 +
1.41 +
1.42 +/**
1.43 + * This class provides static methods for managing uninstalled native packages
1.44 + * (SIS files) that are taking up space on removable drives.
1.45 + *
1.46 + * @publishedAll
1.47 + * @released
1.48 + */
1.49 +
1.50 +NONSHARABLE_CLASS(UninstalledSisPackages)
1.51 +{
1.52 +public:
1.53 +
1.54 + /**
1.55 + * Get the list of uninstalled packages on a specified removable drive. In
1.56 + * this context uninstalled means 'not known by this phone'. This will list
1.57 + * uninstalled PA & PP files found in the SWI Daemon's private directory, and
1.58 + * will also search the sis registry files on the drive for uninstalled
1.59 + * applications.
1.60 + *
1.61 + * @param aDrive Removable drive number (@see TDriveNumber)
1.62 + * @param aPackageList Array of pointers to the uninstalled packages
1.63 + * found on the specified drive (@see
1.64 + * CUninstalledPackageEntry). This array is assumed to be empty.
1.65 + * The caller takes ownership of the elements added to the array.
1.66 + * @leave One of the system-wide error codes.
1.67 + * @leave KErrNotRemovable If the drive is not removable or is substed
1.68 + * @leave KErrPackageFileCorrupt If an error occurs during the processing of files
1.69 + * @capability ReadDeviceData Required to access protected directories during listing operation
1.70 + * @capability ProtServ Required to access services of software installer
1.71 + * @capability TrustedUI Required to access services of software installer
1.72 + */
1.73 + IMPORT_C static void ListL(TDriveNumber aDrive, RPointerArray<CUninstalledPackageEntry>& aPackageList);
1.74 +
1.75 + /**
1.76 + * Remove the specified uninstalled package. The following restrictions apply to the files that will be removed:
1.77 + * <ul>
1.78 + * <li> For security reasons only files on the same drive as the package controller will be removed. Files on other drives will be orphaned.
1.79 + * <li> Files belonging to other packages will not be removed.
1.80 + * </ul>
1.81 + *
1.82 + * @param aPackage The uninstalled package to remove (@see CUninstalledPackageEntry)
1.83 + * @leave One of the system-wide error codes.
1.84 + * @leave KErrNotRemovable If the drive is not removable or is substed
1.85 + * @leave KErrPackageIsInstalled If the specified package is installed on the device
1.86 + * @leave KErrPackageFileCorrupt If an error occurs during the processing of files
1.87 + * @capability WriteDeviceData Required to write to protected directories during remove operation
1.88 + * @capability ProtServ Required to access services of software installer
1.89 + * @capability TrustedUI Required to access services of software installer
1.90 + */
1.91 + IMPORT_C static void RemoveL(const CUninstalledPackageEntry& aPackage);
1.92 +};
1.93 +
1.94 +
1.95 +/**
1.96 + * Uninstalled application entry class.
1.97 + *
1.98 + * This class is not externally instantiable. It is returned as a result of
1.99 + * querying for a list of uninstalled packages present on a removable drive.
1.100 + * Each object of this type represents one uninstalled package. Methods can
1.101 + * be called on this object to retrieve the package details such as
1.102 + * Package UID, Name, Vendor, Version and Type.
1.103 + *
1.104 + * @publishedAll
1.105 + * @released
1.106 + */
1.107 +
1.108 +NONSHARABLE_CLASS(CUninstalledPackageEntry) : public CBase
1.109 +{
1.110 +public:
1.111 + enum TPackageType
1.112 + {
1.113 + ESaPackage, ///< Standard Application
1.114 + ESpPackage, ///< Standard Patch (augmentation)
1.115 + EPuPackage, ///< Partial Upgrade
1.116 + EPaPackage, ///< Preinstalled Application
1.117 + EPpPackage ///< Preinstalled Patch
1.118 + };
1.119 +
1.120 + /**
1.121 + * Get the package Uid
1.122 + *
1.123 + * @return The Uid of this package
1.124 + */
1.125 + IMPORT_C const TUid& Uid() const;
1.126 +
1.127 + /**
1.128 + * Get the package name
1.129 + *
1.130 + * @return The name of this package as reference to TDesC
1.131 + */
1.132 + IMPORT_C const TDesC& Name() const;
1.133 +
1.134 + /**
1.135 + * Get the package unique vendor name
1.136 + *
1.137 + * @return The unique vendor name of this package as reference to TDesC
1.138 + */
1.139 + IMPORT_C const TDesC& Vendor() const;
1.140 +
1.141 + /**
1.142 + * Get the package version
1.143 + *
1.144 + * @return The version number of this package
1.145 + */
1.146 + IMPORT_C const TVersion& Version() const;
1.147 +
1.148 + /**
1.149 + * Get the package type
1.150 + *
1.151 + * @return The package type of this package
1.152 + */
1.153 + IMPORT_C const TPackageType& PackageType() const;
1.154 +
1.155 + /**
1.156 + * Destructor
1.157 + */
1.158 + virtual ~CUninstalledPackageEntry();
1.159 +
1.160 +private:
1.161 + static CUninstalledPackageEntry* NewLC(const TUid& aUid, const TDesC& aPackageName,
1.162 + const TDesC& aVendorName, const TVersion& aVersion, const TPackageType aPackageType,
1.163 + const TDesC& aPackageFile, const TDesC& aAssocStubSisFile);
1.164 +
1.165 +private:
1.166 + CUninstalledPackageEntry();
1.167 +
1.168 +private:
1.169 + void ConstructL(const TUid& aUid, const TDesC& aPackageName, const TDesC& aVendorName,
1.170 + const TVersion& aVersion, const TPackageType aPackageType, const TDesC& aPackageFile,
1.171 + const TDesC& aAssocStubSisFile);
1.172 +
1.173 + const TDesC& PackageFile() const;
1.174 + const TDesC& AssociatedStubSisFile() const;
1.175 +
1.176 +private:
1.177 + /// The package Uid
1.178 + TUid iUid;
1.179 +
1.180 + /// The package name
1.181 + HBufC* iPackageName;
1.182 +
1.183 + /// The package unique vendor name
1.184 + HBufC* iVendorName;
1.185 +
1.186 + /// The package version
1.187 + TVersion iVersion;
1.188 +
1.189 + /// The package type
1.190 + TPackageType iType;
1.191 +
1.192 + // The sis/controller file name with full path
1.193 + HBufC* iPackageFile;
1.194 +
1.195 + // The stub sis file name with full path (if the package file is a controller file)
1.196 + HBufC* iAssocStubSisFile;
1.197 +private:
1.198 + friend class UninstalledSisPackages;
1.199 +};
1.200 +
1.201 +} // namespace Swi
1.202 +
1.203 +#endif // __PKGREMOVER_H__