appfw/apparchitecture/apserv/APSSES.H
changeset 0 2e3d3ce01487
child 29 6a787171e1de
child 47 312d2b433792
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 // apsses.h
       
    15 //
       
    16 
       
    17 #ifndef __APSSES_H__
       
    18 #define __APSSES_H__
       
    19 
       
    20 #include <e32base.h>
       
    21 #include "apsserv.h"
       
    22 #include <f32file.h>
       
    23 #include <apaid.h>
       
    24 #include "APSCLSV.H"
       
    25 #include "APGAPLST.H"
       
    26 #include "APSRECUTIL.H"
       
    27 
       
    28 // classes referenced
       
    29 class CApaAppList;
       
    30 class CApaAppData;
       
    31 class TDataType;
       
    32 class CApsNonNativeApplicationsManager;
       
    33 class MArrayItemWriter;
       
    34 class CFileRecognitionUtility;
       
    35 
       
    36 class CApaAppListServSession : public CBase
       
    37 	{
       
    38 public:
       
    39 	static CApaAppListServSession* NewL(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList);
       
    40 	~CApaAppListServSession();
       
    41 
       
    42 	CApaAppList& AppList();
       
    43 
       
    44 	void NotifyScanComplete();
       
    45 	void SetNotify(const RMessage2& aMessage);
       
    46 	void CancelNotify();
       
    47 	void NotifyClients(TInt aReason);
       
    48 	
       
    49 	void NotifyClientForCompletionOfListPopulation();
       
    50 	void CancelListPopulationCompleteObserver();
       
    51 public:
       
    52 	CApaAppData& FindAppInListL(TUid aUid);
       
    53 	const CApaAppData& FindAppInListL(TUid aUid) const { return const_cast<CApaAppListServSession*>(this)->FindAppInListL(aUid); }
       
    54 	TBool FindAppInList(CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid);
       
    55 	TBool FindAppInList(const CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid) const 
       
    56 		{ return const_cast<CApaAppListServSession*>(this)->FindAppInList(const_cast<CApaAppData*&>(aApp), aEntry, aAppUid); }	
       
    57 	TUid AppUidFromFullFileNameL(const TDesC& aFullFileName) const;
       
    58 	CApaAppData* FindSpecificAppL(TUid aAppUid);
       
    59 public:
       
    60 	void DoServiceL(const RMessage2& aMessage);
       
    61 private:
       
    62 	enum TAppListType {
       
    63 		ENoList,
       
    64 		EListFilteredEmbeddedApps,
       
    65 		EListCapabilityAttrFilteredApps,
       
    66 		EListServerApps
       
    67 		};
       
    68 private:
       
    69 	CApaAppListServSession(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList);
       
    70 	void ConstructL();
       
    71 private:	
       
    72 	void GetAppTypeL(const RMessage2& aMessage);
       
    73 	void ForceRegistrationL(const RMessage2& aMessage);	
       
    74 	void RegisterListPopulationCompleteObserver(const RMessage2& aMessage);
       
    75 	void MatchesSecurityPolicyL(const RMessage2& aMessage);
       
    76 	
       
    77 	void AppCount(const RMessage2& aMessage) const;
       
    78 	void EmbedCount(const RMessage2& aMessage) const;
       
    79 	void GetNextAppL(const RMessage2& aMessage);
       
    80 	void InitListL(const RMessage2& aMessage, TAppListType aType);
       
    81 	void GetAppInfoL(const RMessage2& aMessage);
       
    82 	void GetAppInfoL(TUid aUid, TApaAppInfo& aInfo);
       
    83 	void GetAppCapabilityL(const RMessage2& aMessage);
       
    84 	void GetDefaultScreenNumberL(const RMessage2& aMessage);
       
    85 	
       
    86 	void IconForAppL(const RMessage2& aMessage);
       
    87 	void IconForAppBySizeL(const RMessage2& aMessage);
       
    88 	void AppIconSizesL(const RMessage2& aMessage);
       
    89 	void IconFileHandleForAppL(const RMessage2& aMessage);
       
    90 	void AppViewsL(const RMessage2& aMessage);
       
    91 	void IconForViewBySizeL(const RMessage2& aMessage);
       
    92 	void AppFileOwnershipInfoL(const RMessage2& aMessage);
       
    93 
       
    94 	void NumberOfOwnDefinedIconsL(const RMessage2& aMessage);
       
    95 
       
    96 	void AppInfoProvidedByRegistrationFileL(const RMessage2& aMessage);
       
    97 	void IconFileNameL(const RMessage2& aMessage);
       
    98 	void ViewIconFileNameL(const RMessage2& aMessage);
       
    99 	
       
   100 	void ApplicationLanguageL(const RMessage2& aMessage);
       
   101 	void SetAppShortCaptionL(const RMessage2& aMessage);
       
   102 private:		
       
   103 	static TInt NextDriveToScan(TInt aCurrentDrive);	
       
   104 	static TBool AppIsControlPanelItem(const CApaAppData& aAppData);
       
   105 	TBool AppMatchesEmbeddabilityFilter(const CApaAppData& aAppData, const TApaEmbeddabilityFilter& aEmbeddabilityFilter) const;
       
   106 	TBool AppMatchesCapabilityAttrFilter(const CApaAppData& aAppData) const;
       
   107 	void SendArrayL(const MArrayItemWriter& aArrayItemWriter,const RMessage2& aMessage) const;	
       
   108 private:
       
   109 	class CApaAppInfo;
       
   110 private:
       
   111 	enum TFlags
       
   112 		{
       
   113 		ENotifyPresent=0x01,
       
   114 		EAppListPopulationPending=0x02
       
   115 		};
       
   116 private:
       
   117 	RFs& iFs;
       
   118 	TInt iFlags;
       
   119 	CApaAppArcServer& iAppArcSrv;
       
   120 	CApaAppList& iAppList;
       
   121 	RMessage2 iNotifyMessage;
       
   122 	RMessage2 iNotifyOnScanCompleteMsg;
       
   123 	CApsNonNativeApplicationsManager* iNonNativeApplicationsManager;
       
   124 	RMessage2 iCompletionOfListPopulationObserverMsg;
       
   125 		
       
   126 	TAppListType iAppListType;
       
   127 	TInt iAppListScreenMode;
       
   128 	TApaEmbeddabilityFilter iEmbeddabilityFilter;
       
   129 	TUint iCapabilityAttrFilterMask; // contains bit flags from TCapabilityAttribute
       
   130 	TUint iCapabilityAttrFilterValue; // contains bit flags from TCapabilityAttribute
       
   131 	TUid iServiceUid;
       
   132 	RPointerArray<CApaAppInfo> iApaAppInfoArray;	//contains the most recent "snapshot" of the applist taken by GetNextAppL.
       
   133 	};
       
   134 	
       
   135 	
       
   136 class CApaAppArcServSession : public CSession2
       
   137 	{
       
   138 public:
       
   139 	// construct/destruct
       
   140 	static CApaAppArcServSession* NewL(CApaAppArcServer& aServer, RFs& aFs);
       
   141 	~CApaAppArcServSession();
       
   142 	//service request
       
   143 	virtual void ServiceL(const RMessage2 &aMessage);
       
   144 
       
   145 	void NotifyClientOfDataMappingChange();
       
   146 	void NotifyClients(TInt aReason);
       
   147 	void NotifyScanComplete();
       
   148 	void NotifyClientForCompletionOfListPopulation();
       
   149 private:
       
   150 	CApaAppArcServSession(CApaAppArcServer& aServer, RFs& aFs);
       
   151 	void ConstructL();
       
   152 	void NotifyOnDataMappingChange(const RMessage2& aMessage);
       
   153 	void CancelNotifyOnDataMappingChange();
       
   154 private:
       
   155 	// Data recognition stuff
       
   156 	void RecognizeDataL(const RMessage2& aMessage);
       
   157 	void RecognizeDataPassedByFileHandleL(const RMessage2& aMessage);
       
   158 	void RecognizeSpecificDataL(const RMessage2& aMessage);
       
   159 	void RecognizeSpecificDataPassedByFileHandleL(const RMessage2& aMessage);
       
   160 	static void DoRecognizeUnpackLC(HBufC*& aName, HBufC8*& aBuffer, const RMessage2& aMessage);
       
   161 
       
   162 	void AppForDataTypeL(const RMessage2& aMessage);
       
   163 	TUid AppForDataTypeL(const TDataType& aDataType, const TUid* aServiceUid);
       
   164 	void AppForDocumentL(const RMessage2& aMessage, const TUid* aServiceUid);
       
   165 
       
   166 	void RecognizeFilesL(const RMessage2& aMessage);
       
   167 	void TransferRecognitionResultL(const RMessage2& aMessage);
       
   168 	void RecognizeFilesAsyncL(const RMessage2& aMessage);
       
   169 	void AquirePermissionToLaunchAppL(const RMessage2& aMessage) const;
       
   170 	void CancelRecognizeFiles();
       
   171 
       
   172 	void InsertDataMappingL(const RMessage2& aMessage);
       
   173 	void DeleteDataMappingL(const RMessage2& aMessage);
       
   174 	void GetAppByDataTypeL(const RMessage2& aMessage) const;
       
   175 
       
   176 	void GetAppServicesL(const RMessage2& aMessage);
       
   177 	CBufBase* GetServiceBufferL(const RMessage2& aMessage) const;
       
   178 	void AppForDataTypeAndServiceL(const RMessage2& aMessage);
       
   179 	void AppForDocumentPassedByFileHandleL(const RMessage2& aMessage, const TUid* aServiceUid);
       
   180 
       
   181 	void RegisterNonNativeApplicationTypeL(const RMessage2& aMessage);
       
   182 	void DeregisterNonNativeApplicationTypeL(const RMessage2& aMessage);
       
   183 
       
   184 	void GetExecutableNameGivenDocumentL(const RMessage2& aMessage);
       
   185 	void GetExecutableNameGivenDocumentPassedByFileHandleL(const RMessage2& aMessage);
       
   186 	void GetExecutableNameGivenDataTypeL(const RMessage2& aMessage);
       
   187 	void GetExecutableNameGivenAppUidL(const RMessage2& aMessage);
       
   188 	void GetExecutableNameL(const RMessage2& aMessage, TUid aAppUid);
       
   189 	void GetNativeExecutableNameIfNonNativeL(const RMessage2& aMessage);
       
   190 	void WriteNativeExecutableIfNonNativeAndPrepareForClientRetrievalOfOpaqueDataL(const RMessage2& aMessage, TInt aMessageSlotForNativeExecutable, const CApaAppData& aAppData);
       
   191 	void GetOpaqueDataL(const RMessage2& aMessage);
       
   192 
       
   193 	void GetConfidenceL(const RMessage2& aMessage);
       
   194 	void SetConfidence(const RMessage2& aMessage);
       
   195 	void GetBufSize(const RMessage2& aMessage);
       
   196 	void SetBufSize(const RMessage2& aMessage);
       
   197 	void GetDataTypesCountL(const RMessage2& aMessage);
       
   198 	void GetDataTypesL(const RMessage2& aMessage);
       
   199 	
       
   200 	TInt PreferredBufSize() const;
       
   201 private:
       
   202 	CApaAppArcServer& iServ;
       
   203 	CApaAppListServSession* iAppListSession;
       
   204 	RFs& iFs;
       
   205 	TInt iMaxBufSize;
       
   206 	CBufBase* iBuffer;
       
   207 	CDirectoryRecognitionResult* iRecognitionResult;
       
   208 	CFileRecognitionUtility* iFileRecognitionUtility;
       
   209 	TBool iAsyncRecognitionActive;
       
   210 	HBufC8* iOpaqueData_pendingDispatchToClient;
       
   211 	RMessagePtr2 iMessage_NotifyOnDataMappingChange;
       
   212 	};
       
   213 
       
   214 
       
   215 #endif	// __APSSES_H__