1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // apsses.h |
15 |
15 // |
16 #if !defined(__APSSES_H__) |
16 |
|
17 #ifndef __APSSES_H__ |
17 #define __APSSES_H__ |
18 #define __APSSES_H__ |
18 |
19 |
19 #if !defined(__E32BASE_H__) |
|
20 #include <e32base.h> |
20 #include <e32base.h> |
21 #endif |
21 #include "apsserv.h" |
22 #if !defined(__APSSERV_H__) |
|
23 #include <APSSERV.H> |
|
24 #endif |
|
25 #if !defined(__F32FILE_H__) |
|
26 #include <f32file.h> |
22 #include <f32file.h> |
27 #endif |
|
28 #if !defined(__APAID_H__) |
|
29 #include <apaid.h> |
23 #include <apaid.h> |
30 #endif |
|
31 #if !defined(__APSCLSV_H__) |
|
32 #include "APSCLSV.H" |
24 #include "APSCLSV.H" |
33 #endif |
|
34 |
|
35 #include "APGAPLST.H" |
25 #include "APGAPLST.H" |
36 #include "APSRECUTIL.H" |
26 #include "APSRECUTIL.H" |
37 |
27 |
38 // classes defined |
|
39 class CApaAppListServSession; |
|
40 // |
|
41 // classes referenced |
28 // classes referenced |
42 class CApaAppList; |
29 class CApaAppList; |
43 class CApaAppData; |
30 class CApaAppData; |
44 class CApaFileRecognizer; |
|
45 class CApaScanningDataRecognizer; |
|
46 class TDataType; |
31 class TDataType; |
47 class CTypeStoreManager; |
|
48 class CApsNonNativeApplicationsManager; |
32 class CApsNonNativeApplicationsManager; |
49 // |
|
50 class MArrayItemWriter; |
33 class MArrayItemWriter; |
51 |
|
52 class CFileRecognitionUtility; |
34 class CFileRecognitionUtility; |
53 |
35 |
54 class CApaAppListServSession : public CSession2 |
36 class CApaAppListServSession : public CBase |
55 { |
37 { |
56 public: |
38 public: |
57 // construct/destruct |
39 static CApaAppListServSession* NewL(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList); |
58 static CApaAppListServSession* NewL(CApaAppListServer& aServer, RFs& aFs); |
|
59 ~CApaAppListServSession(); |
40 ~CApaAppListServSession(); |
60 //service request |
41 |
61 virtual void ServiceL(const RMessage2 &aMessage); |
42 CApaAppList& AppList(); |
|
43 |
|
44 void NotifyScanComplete(); |
|
45 void SetNotify(const RMessage2& aMessage); |
|
46 void CancelNotify(); |
62 void NotifyClients(TInt aReason); |
47 void NotifyClients(TInt aReason); |
|
48 |
63 void NotifyClientForCompletionOfListPopulation(); |
49 void NotifyClientForCompletionOfListPopulation(); |
64 void NotifyClientOfDataMappingChange(); |
50 void CancelListPopulationCompleteObserver(); |
65 void NotifyScanComplete(); |
51 public: |
66 private: |
52 CApaAppData& FindAppInListL(TUid aUid); |
67 CApaAppListServSession(CApaAppListServer& aServer, RFs& aFs); |
53 const CApaAppData& FindAppInListL(TUid aUid) const { return const_cast<CApaAppListServSession*>(this)->FindAppInListL(aUid); } |
68 void ConstructL(); |
54 TBool FindAppInList(CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid); |
69 void NotifyOnDataMappingChange(const RMessage2& aMessage); |
55 TBool FindAppInList(const CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid) const |
70 void CancelNotifyOnDataMappingChange(); |
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); |
71 private: |
61 private: |
72 enum TAppListType { |
62 enum TAppListType { |
73 ENoList, |
63 ENoList, |
74 EListFilteredEmbeddedApps, |
64 EListFilteredEmbeddedApps, |
75 EListCapabilityAttrFilteredApps, |
65 EListCapabilityAttrFilteredApps, |
76 EListServerApps |
66 EListServerApps |
77 }; |
67 }; |
78 enum TAppListDocumentStart { |
68 private: |
79 EStart, |
69 CApaAppListServSession(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList); |
80 EStartByDataType, |
70 void ConstructL(); |
81 EStartByUid, |
71 private: |
82 ECreateByUid |
72 void GetAppTypeL(const RMessage2& aMessage); |
83 }; |
73 void ForceRegistrationL(const RMessage2& aMessage); |
84 private: |
74 void RegisterListPopulationCompleteObserver(const RMessage2& aMessage); |
85 class CApaAppInfo; |
75 void MatchesSecurityPolicyL(const RMessage2& aMessage); |
86 private: |
76 |
87 void AppCount(const RMessage2& aMessage) const; |
77 void AppCount(const RMessage2& aMessage) const; |
88 void EmbedCount(const RMessage2& aMessage) const; |
78 void EmbedCount(const RMessage2& aMessage) const; |
89 void GetNextAppL(const RMessage2& aMessage); |
79 void GetNextAppL(const RMessage2& aMessage); |
90 void InitListL(const RMessage2& aMessage, TAppListType aType); |
80 void InitListL(const RMessage2& aMessage, TAppListType aType); |
91 void GetAppInfoL(const RMessage2& aMessage); |
81 void GetAppInfoL(const RMessage2& aMessage); |
92 void GetAppInfoL(TUid aUid, TApaAppInfo& aInfo); |
82 void GetAppInfoL(TUid aUid, TApaAppInfo& aInfo); |
93 void GetAppCapabilityL(const RMessage2& aMessage); |
83 void GetAppCapabilityL(const RMessage2& aMessage); |
94 void GetDefaultScreenNumberL(const RMessage2& aMessage); |
84 void GetDefaultScreenNumberL(const RMessage2& aMessage); |
95 void StartAppL(const RMessage2& aMessage, TBool aReturnThreadId); |
85 |
96 // |
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: |
97 // Data recognition stuff |
155 // Data recognition stuff |
98 void RecognizeDataL(const RMessage2& aMessage); |
156 void RecognizeDataL(const RMessage2& aMessage); |
99 void RecognizeDataPassedByFileHandleL(const RMessage2& aMessage); |
157 void RecognizeDataPassedByFileHandleL(const RMessage2& aMessage); |
100 void RecognizeSpecificDataL(const RMessage2& aMessage); |
158 void RecognizeSpecificDataL(const RMessage2& aMessage); |
101 void RecognizeSpecificDataPassedByFileHandleL(const RMessage2& aMessage); |
159 void RecognizeSpecificDataPassedByFileHandleL(const RMessage2& aMessage); |
102 static void DoRecognizeUnpackLC(HBufC*& aName, HBufC8*& aBuffer, const RMessage2& aMessage); |
160 static TPtrC8 DoRecognizeUnpackLC(HBufC*& aName, RChunk& aLocalChunk, const RMessage2& aMessage); |
103 // |
161 |
104 void AppForDataTypeL(const RMessage2& aMessage); |
162 void AppForDataTypeL(const RMessage2& aMessage); |
105 void StartDocumentL(const RMessage2& aMessage,TAppListDocumentStart aStartType); |
163 TUid AppForDataTypeL(const TDataType& aDataType, const TUid* aServiceUid); |
106 TThreadId StartDocumentL(const TDesC& aFileName, TUid aUid, TApaCommand aCommand); |
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 |
107 void GetExecutableNameGivenDocumentL(const RMessage2& aMessage); |
184 void GetExecutableNameGivenDocumentL(const RMessage2& aMessage); |
108 void GetExecutableNameGivenDocumentPassedByFileHandleL(const RMessage2& aMessage); |
185 void GetExecutableNameGivenDocumentPassedByFileHandleL(const RMessage2& aMessage); |
109 void GetExecutableNameGivenDataTypeL(const RMessage2& aMessage); |
186 void GetExecutableNameGivenDataTypeL(const RMessage2& aMessage); |
110 void GetExecutableNameGivenAppUidL(const RMessage2& aMessage); |
187 void GetExecutableNameGivenAppUidL(const RMessage2& aMessage); |
111 void GetExecutableNameL(const RMessage2& aMessage, TUid aAppUid); |
188 void GetExecutableNameL(const RMessage2& aMessage, TUid aAppUid); |
112 void GetNativeExecutableNameIfNonNativeL(const RMessage2& aMessage); |
189 void GetNativeExecutableNameIfNonNativeL(const RMessage2& aMessage); |
113 void WriteNativeExecutableIfNonNativeAndPrepareForClientRetrievalOfOpaqueDataL(const RMessage2& aMessage, TInt aMessageSlotForNativeExecutable, const CApaAppData& aAppData); |
190 void WriteNativeExecutableIfNonNativeAndPrepareForClientRetrievalOfOpaqueDataL(const RMessage2& aMessage, TInt aMessageSlotForNativeExecutable, const CApaAppData& aAppData); |
114 void GetOpaqueDataL(const RMessage2& aMessage); |
191 void GetOpaqueDataL(const RMessage2& aMessage); |
115 TUid AppForDataTypeL(const TDataType& aDataType, const TUid* aServiceUid); |
|
116 void AppForDocumentL(const RMessage2& aMessage, const TUid* aServiceUid); |
|
117 // |
|
118 void IconForAppL(const RMessage2& aMessage); |
|
119 // |
|
120 void IconForAppBySizeL(const RMessage2& aMessage); |
|
121 void AppIconSizesL(const RMessage2& aMessage); |
|
122 void IconFileHandleForAppL(const RMessage2& aMessage); |
|
123 // |
|
124 void AppViewsL(const RMessage2& aMessage); |
|
125 void IconForViewBySizeL(const RMessage2& aMessage); |
|
126 void AppFileOwnershipInfoL(const RMessage2& aMessage); |
|
127 // |
|
128 void NumberOfOwnDefinedIconsL(const RMessage2& aMessage); |
|
129 // |
|
130 void AppInfoProvidedByRegistrationFileL(const RMessage2& aMessage); |
|
131 void IconFileNameL(const RMessage2& aMessage); |
|
132 void ViewIconFileNameL(const RMessage2& aMessage); |
|
133 // |
|
134 void RecognizeFilesL(const RMessage2& aMessage); |
|
135 void TransferRecognitionResultL(const RMessage2& aMessage); |
|
136 void RecognizeFilesAsyncL(const RMessage2& aMessage); |
|
137 void RuleBasedLaunchingL(const RMessage2& aMessage); |
|
138 void CancelRecognizeFiles(); |
|
139 // |
|
140 void InsertDataMappingL(const RMessage2& aMessage); |
|
141 void DeleteDataMappingL(const RMessage2& aMessage); |
|
142 void GetAppByDataTypeL(const RMessage2& aMessage) const; |
|
143 // |
|
144 void GetAppServicesL(const RMessage2& aMessage); |
|
145 CBufBase* GetServiceBufferL(const RMessage2& aMessage) const; |
|
146 void AppForDataTypeAndServiceL(const RMessage2& aMessage); |
|
147 void AppForDocumentPassedByFileHandleL(const RMessage2& aMessage, const TUid* aServiceUid); |
|
148 |
|
149 void RegisterNonNativeApplicationTypeL(const RMessage2& aMessage); |
|
150 void DeregisterNonNativeApplicationTypeL(const RMessage2& aMessage); |
|
151 |
|
152 void GetAppTypeL(const RMessage2& aMessage); |
|
153 void ForceRegistrationL(const RMessage2& aMessage); |
|
154 inline const CApaAppList& AppList() const; |
|
155 inline CApaFileRecognizer* FileRecognizer() const; |
|
156 CApaAppData& FindAppInListL(TUid aUid); |
|
157 TBool FindAppInList(CApaAppData*& aApp,TApaAppEntry& aEntry,TUid aAppUid); |
|
158 TBool AppMatchesEmbeddabilityFilter(const CApaAppData& aAppData, const TApaEmbeddabilityFilter& aEmbeddabilityFilter) const; |
|
159 TBool AppMatchesCapabilityAttrFilter(const CApaAppData& aAppData) const; |
|
160 static TBool AppIsControlPanelItem(const CApaAppData& aAppData); |
|
161 |
192 |
162 void GetConfidenceL(const RMessage2& aMessage); |
193 void GetConfidenceL(const RMessage2& aMessage); |
163 void SetConfidence(const RMessage2& aMessage); |
194 void SetConfidence(const RMessage2& aMessage); |
164 void GetBufSize(const RMessage2& aMessage); |
195 void GetBufSize(const RMessage2& aMessage); |
165 void SetBufSize(const RMessage2& aMessage); |
196 void SetBufSize(const RMessage2& aMessage); |
166 void GetDataTypesCountL(const RMessage2& aMessage); |
197 void GetDataTypesCountL(const RMessage2& aMessage); |
167 void GetDataTypesL(const RMessage2& aMessage); |
198 void GetDataTypesL(const RMessage2& aMessage); |
168 void SetNotify(const RMessage2& aMessage); |
199 |
169 void CancelNotify(); |
|
170 // |
|
171 void SendArrayL(const MArrayItemWriter& aArrayItemWriter,const RMessage2& aMessage) const; |
|
172 // |
|
173 void ApplicationLanguageL(const RMessage2& aMessage); |
|
174 void RegisterListPopulationCompleteObserver(const RMessage2& aMessage); |
|
175 void CancelListPopulationCompleteObserver(); |
|
176 void MatchesSecurityPolicyL(const RMessage2& aMessage); |
|
177 // |
|
178 void SetAppShortCaptionL(const RMessage2& aMessage); |
|
179 |
|
180 static void NullifyAppCommandLinePointer(TAny* aServer); |
|
181 TInt PreferredBufSize() const; |
200 TInt PreferredBufSize() const; |
182 CApaAppData* FindSpecificAppL(TUid aAppUid); |
201 private: |
183 TUid AppUidFromFullFileNameL(const TDesC& aFullFileName) const; |
202 CApaAppArcServer& iServ; |
184 static TInt NextDriveToScan(TInt aCurrentDrive); |
203 CApaAppListServSession* iAppListSession; |
185 |
|
186 private: |
|
187 enum |
|
188 { |
|
189 ENotifyPresent=0x01, |
|
190 EAppListPopulationPending=0x02 |
|
191 }; |
|
192 |
|
193 private: |
|
194 CApaAppListServer& iServ; |
|
195 TInt iFlags; |
|
196 RFs& iFs; |
204 RFs& iFs; |
197 TInt iMaxBufSize; |
205 TInt iMaxBufSize; |
198 CBufBase* iBuffer; |
206 CBufBase* iBuffer; |
199 RMessage2 iNotifyMessage; |
|
200 RMessage2 iNotifyOnScanCompleteMsg; |
|
201 RPointerArray<CApaAppInfo> iApaAppInfoArray; //contains the most recent "snapshot" of the applist taken by GetNextAppL. |
|
202 TAppListType iAppListType; |
|
203 TInt iAppListScreenMode; |
|
204 TApaEmbeddabilityFilter iEmbeddabilityFilter; |
|
205 TUint iCapabilityAttrFilterMask; // contains bit flags from TCapabilityAttribute |
|
206 TUint iCapabilityAttrFilterValue; // contains bit flags from TCapabilityAttribute |
|
207 TUid iServiceUid; |
|
208 RMessage2 iCompletionOfListPopulationObserverMsg; |
|
209 CDirectoryRecognitionResult* iRecognitionResult; |
207 CDirectoryRecognitionResult* iRecognitionResult; |
210 CFileRecognitionUtility* iFileRecognitionUtility; |
208 CFileRecognitionUtility* iFileRecognitionUtility; |
211 TBool iAsyncRecognitionActive; |
209 TBool iAsyncRecognitionActive; |
212 HBufC8* iOpaqueData_pendingDispatchToClient; |
210 HBufC8* iOpaqueData_pendingDispatchToClient; |
213 RMessagePtr2 iMessage_NotifyOnDataMappingChange; |
211 RMessagePtr2 iMessage_NotifyOnDataMappingChange; |
214 CApsNonNativeApplicationsManager* iNonNativeApplicationsManager; |
|
215 }; |
212 }; |
216 |
213 |
217 // |
214 |
218 // inlines |
215 #endif // __APSSES_H__ |
219 // |
|
220 |
|
221 inline const CApaAppList& CApaAppListServSession::AppList() const |
|
222 { return ((CApaAppListServer*)Server())->AppList(); } |
|
223 |
|
224 inline CApaFileRecognizer* CApaAppListServSession::FileRecognizer() const |
|
225 { return ((CApaAppListServer*)Server())->FileRecognizer(); } |
|
226 |
|
227 #endif |
|