appfw/apparchitecture/aplist/aplapplistitem.h
changeset 0 2e3d3ce01487
child 29 6a787171e1de
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1997-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // aplapplistitem.h
       
    15 //
       
    16 
       
    17 #ifndef __APLAPPLISTITEM_H__
       
    18 #define __APLAPPLISTITEM_H__
       
    19 
       
    20 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    21 #if !defined(__APAID_PARTNER_H__)
       
    22 #include "apaidpartner.h"
       
    23 #endif
       
    24 #include <apmfndr.h>
       
    25 #else
       
    26 #include <apmstd.h>
       
    27 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    28 #include <apaid.h>
       
    29 #include <badesca.h>
       
    30 #include <s32file.h>
       
    31 
       
    32 // classes defined:
       
    33 class CApaAppData;
       
    34 class CApaAppList;
       
    35 class CApaAppViewData;
       
    36 class CApaMaskedBitmap;
       
    37 class TEntry;
       
    38 class RFs;
       
    39 class CApaAppRegFinder;
       
    40 class CApaAppIconArray;
       
    41 class CApaIconLoader;
       
    42 
       
    43 
       
    44 
       
    45 /** An application entry.
       
    46 
       
    47 An object of this type contains two pieces of information:
       
    48 
       
    49 the full path name of the application DLL
       
    50 
       
    51 the UID type (or compound identifier) of the application DLL. 
       
    52 
       
    53 @internalComponent
       
    54 @released */
       
    55 class TApaAppEntry
       
    56 	{
       
    57 public:
       
    58 	IMPORT_C TApaAppEntry();
       
    59 	TApaAppEntry(const TUidType& aAppUidType,const TFileName& aDllName);
       
    60 	void ExternalizeL(RWriteStream& aStream)const;
       
    61 	void InternalizeL(RReadStream& aStream);
       
    62 public:
       
    63 	/** The UID type (or compound identifier) of the application DLL. */
       
    64 	TUidType iUidType;
       
    65 	/** The full path name of the application DLL. */
       
    66 	TFileName iFullName;
       
    67 private:
       
    68 	TInt iTApaAppEntry_Reserved1;
       
    69 	};
       
    70 
       
    71 /**
       
    72 Utility class with smaller RAM footprint than TApaAppEntry
       
    73 
       
    74 @internalComponent
       
    75 */
       
    76 class CApaAppEntry : public CBase
       
    77 	{
       
    78 public:
       
    79 	static CApaAppEntry* NewL(const TApaAppEntry& aAppEntry);
       
    80 	~CApaAppEntry();
       
    81 	void Get(TApaAppEntry& aAppEntry) const;
       
    82 private:
       
    83 	CApaAppEntry(const TUidType& aUidType);
       
    84 	void ConstructL(const TDesC& aFileName);
       
    85 private:
       
    86 	TUidType iUidType;
       
    87 	HBufC* iFullName;
       
    88 	};
       
    89 
       
    90 /** Represents the data associated with a CApaApplication, such as its 
       
    91 caption, capabilities and icons. This should be accessed through the Apparc Server.
       
    92 
       
    93 @internalComponent
       
    94 */
       
    95 class CApaAppData : public CBase
       
    96 	{
       
    97 public:
       
    98 	IMPORT_C static CApaAppData* NewL(const TApaAppEntry& aAppEntry, RFs& aFs);
       
    99 	IMPORT_C ~CApaAppData();
       
   100 	IMPORT_C TApaAppEntry AppEntry() const;
       
   101 	inline TPtrC Caption() const;
       
   102 	inline TPtrC ShortCaption() const;
       
   103 	IMPORT_C CApaMaskedBitmap* Icon(TInt aIconIndex) const;
       
   104 	IMPORT_C void Capability(TDes8& aCapabilityBuf)const;
       
   105 	inline TBool IsPresent() const;
       
   106 	// ER5
       
   107 	IMPORT_C TDataTypePriority DataType(const TDataType& aDataType) const;
       
   108 	// ER6
       
   109 	IMPORT_C CApaMaskedBitmap* Icon(TSize aSize) const;
       
   110 	IMPORT_C CArrayFixFlat<TSize>* IconSizesL() const;
       
   111 	// ER6.1
       
   112 	IMPORT_C CArrayPtrFlat<CApaAppViewData>* Views() const;
       
   113 	IMPORT_C CDesCArray* OwnedFiles() const;
       
   114 	IMPORT_C TBool CanUseScreenMode(TInt aScreenMode);
       
   115 	// 7.0s
       
   116 	IMPORT_C void GetIconInfo(TInt& aIconCount, TInt& aDefaultIconsUsed) const;
       
   117 	// 8.1
       
   118 	IMPORT_C TUint DefaultScreenNumber() const;
       
   119 	IMPORT_C TBool RegistrationFileUsed() const;
       
   120 	IMPORT_C TPtrC IconFileName() const;
       
   121 	IMPORT_C TBool NonMbmIconFile() const;
       
   122 
       
   123 	// 9.0
       
   124 	IMPORT_C TBool ImplementsService(TUid aServiceUid) const;
       
   125 	TInt ImplementsServiceWithDataType(TUid aServiceUid, const TDataType& aDataType) const;
       
   126 
       
   127 	// 9.1
       
   128 	IMPORT_C TLanguage ApplicationLanguage() const;
       
   129 	IMPORT_C TPtrC RegistrationFileName() const;
       
   130 	IMPORT_C TPtrC8 OpaqueData() const;
       
   131 	IMPORT_C TUid NonNativeApplicationType() const;
       
   132 	IMPORT_C TPtrC LocalisableResourceFileName() const;
       
   133 	IMPORT_C void SetShortCaptionL(const TDesC& aShortCaption);
       
   134 	IMPORT_C TBool IsPending()const;
       
   135 	// 9.5
       
   136 	IMPORT_C void SetCaptionL(const TDesC& aCaption);
       
   137 	IMPORT_C void SetIconsL(const TDesC& aFileName, TInt aNumIcons);
       
   138 
       
   139 	void ExternalizeL(RWriteStream& aWriteStream) const;	
       
   140 	void LoadIconsL();
       
   141 	TBool MbmIconsRequireLoading() const;
       
   142 	inline CApaAppData* Next() const;
       
   143 private:
       
   144 	CApaAppData(RFs& aFs);
       
   145 	TBool Update();
       
   146 	void SetAppPending();
       
   147 
       
   148 	void ConstructL(const TApaAppEntry& aAppEntry);
       
   149 	TInt ReadApplicationInformationFromResourceFiles();
       
   150 	void UpdateServiceArray(CArrayFixFlat<TApaAppServiceInfo>* aNewServiceArray);
       
   151 	TDataTypePriority DataType(const TDataType& aDataType, const CArrayFixFlat<TDataTypeWithPriority>& aDataTypeArray) const;
       
   152 	void InternalizeL(RReadStream& aReadStream);
       
   153 	TBool ViewMbmIconsRequireLoading() const;
       
   154 private:
       
   155 	enum { ENotPresent, ENotPresentPendingUpdate, EPresentPendingUpdate, EIsPresent, ESuperseded };
       
   156 private:
       
   157 	CApaAppIconArray* iIcons;
       
   158 	HBufC* iCaption;
       
   159 	HBufC* iShortCaption;
       
   160 	HBufC* iFullName; // filename of application binary
       
   161 	TInt iIsPresent; // uses enum
       
   162 	TUidType iUidType;
       
   163 	CApaAppData* iNext;
       
   164 	TApaAppCapabilityBuf iCapabilityBuf;
       
   165 	CApaAppEntry* iSuccessor;
       
   166 	TTime iTimeStamp;
       
   167 	CArrayPtrFlat<CApaAppViewData>* iViewDataArray;
       
   168 	CDesCArray* iOwnedFileArray;
       
   169  	RFs& iFs;
       
   170  	HBufC* iRegistrationFile;
       
   171  	TUint iDefaultScreenNumber;
       
   172  	HBufC* iIconFileName;
       
   173  	TBool iNonMbmIconFile;
       
   174  	HBufC* iLocalisableResourceFileName;
       
   175  	TTime iLocalisableResourceFileTimeStamp;
       
   176 	TTime iIconFileTimeStamp;
       
   177  	TLanguage iApplicationLanguage;
       
   178  	CArrayFixFlat<TApaAppServiceInfo>* iServiceArray;
       
   179  	TInt iIndexOfFirstOpenService;
       
   180 	TUid iNonNativeApplicationType;
       
   181 	HBufC8* iOpaqueData;
       
   182  	TInt iNumOfAppIcons;
       
   183 	TInt iNumOfAppIconsFromResourceFile;
       
   184  	HBufC* iIconFileNameFromResourceFile; // Icon file name as found in the localisable resource file
       
   185  	TBool iNonMbmIconFileFromResourceFile; // A Flag that tells whether the icon in resource file is non MBM file format
       
   186  	TTime iIconFileTimeStampFromResourceFile;
       
   187 	HBufC* iShortCaptionFromResourceFile;	// Short Caption as found in the localisable resource file
       
   188 	HBufC* iCaptionFromResourceFile;		// Caption as found in the localisable resource file
       
   189 	CApaIconLoader* iIconLoader;
       
   190 private:
       
   191 	friend class CApaAppList;
       
   192 	};
       
   193 
       
   194 /**
       
   195 The CApaAppViewData class represents the data associated with an application view.
       
   196 
       
   197 @internalComponent
       
   198 */
       
   199 class CApaAppViewData : public CBase
       
   200 	{
       
   201 public:
       
   202 	IMPORT_C TUid Uid() const;
       
   203 	inline TPtrC Caption() const;
       
   204 	IMPORT_C CApaMaskedBitmap* Icon(const TSize& aSize) const;
       
   205 	IMPORT_C CArrayFixFlat<TSize>* IconSizesL() const;
       
   206 	IMPORT_C TInt ScreenMode() const;
       
   207 	IMPORT_C TPtrC IconFileName() const;
       
   208 	IMPORT_C TBool NonMbmIconFile() const;
       
   209 public:
       
   210 	~CApaAppViewData();
       
   211 	static CApaAppViewData* NewLC();
       
   212 	void SetUid(TUid aUid);
       
   213 	void SetCaptionL(const TDesC& aCaption);
       
   214 	void SetIconArray(CApaAppIconArray* aIcons);
       
   215 	void SetScreenMode(TInt aScreenMode);
       
   216 	void SetIconFileNameL(const TDesC& aFileName);
       
   217 	void SetNonMbmIconFile(TBool aNonMbmIconFile);
       
   218 	void SetNumOfViewIcons(TInt aNumOfViewIcons);
       
   219 private:
       
   220 	CApaAppViewData();
       
   221 	void ConstructL();
       
   222 private:
       
   223 	CApaAppIconArray* iIcons;
       
   224 	HBufC* iCaption;
       
   225 	TUid iUid;
       
   226 	TInt iScreenMode;
       
   227 	HBufC* iIconFileName;
       
   228 	TBool iNonMbmIconFile;
       
   229 	TInt iNumOfViewIcons;
       
   230 	friend class CApaAppData;
       
   231 	};
       
   232 
       
   233 //
       
   234 // inlines
       
   235 //
       
   236 
       
   237 inline TPtrC CApaAppViewData::Caption() const
       
   238 	{ return *iCaption; }
       
   239 
       
   240 /** Gets the application's caption.
       
   241 
       
   242 @return The application's caption. */
       
   243 inline TPtrC CApaAppData::Caption() const
       
   244 	{ return *iCaption; }
       
   245 
       
   246 /** Gets the application's short caption.
       
   247 
       
   248 @return The application's short caption. */
       
   249 inline TPtrC CApaAppData::ShortCaption() const
       
   250 	{ return *iShortCaption; }
       
   251 
       
   252 /** Tests whether the application is present or not on the device.
       
   253 
       
   254 @return True if application exists, else false. */
       
   255 inline TBool CApaAppData::IsPresent() const
       
   256 	{ return iIsPresent; }
       
   257 
       
   258 /** Gets the Next Appdata in the list
       
   259 
       
   260 @return iNext */
       
   261 inline CApaAppData* CApaAppData::Next() const
       
   262 	{ return iNext; }
       
   263 
       
   264 #endif //__APLAPPLISTITEM_H__