21 |
21 |
22 #include <ccpixindexer.h> |
22 #include <ccpixindexer.h> |
23 #include <csearchdocument.h> |
23 #include <csearchdocument.h> |
24 #include <e32base.h> |
24 #include <e32base.h> |
25 //#include <menu2internalcrkeys.h> //for KCRUidMenu |
25 //#include <menu2internalcrkeys.h> //for KCRUidMenu |
26 #include <widgetpropertyvalue.h> // EBundleDisplayName |
26 #include <WidgetPropertyValue.h> // EBundleDisplayName |
27 #include <centralrepository.h> |
27 #include <centralrepository.h> |
|
28 #include <opensystemtrace.h> |
|
29 #include "OstTraceDefinitions.h" |
|
30 #ifdef OST_TRACE_COMPILER_IN_USE |
|
31 #include "applicationspluginTraces.h" |
|
32 #endif |
|
33 |
28 |
34 |
29 //Hidden applications |
35 //Hidden applications |
30 //#define KHiddenAppRepositoryUid KCRUidMenu |
36 //#define KHiddenAppRepositoryUid KCRUidMenu |
31 |
37 |
32 _LIT( KMimeTypeField, CPIX_MIMETYPE_FIELD ); |
38 _LIT( KMimeTypeField, CPIX_MIMETYPE_FIELD ); |
45 const TInt KHarvestingDelay = 1000; |
51 const TInt KHarvestingDelay = 1000; |
46 |
52 |
47 // ----------------------------------------------------------------------------- |
53 // ----------------------------------------------------------------------------- |
48 CApplicationsPlugin* CApplicationsPlugin::NewL() |
54 CApplicationsPlugin* CApplicationsPlugin::NewL() |
49 { |
55 { |
|
56 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_NEWL_ENTRY ); |
50 CPIXLOGSTRING("CApplicationsPlugin::NewL()"); |
57 CPIXLOGSTRING("CApplicationsPlugin::NewL()"); |
51 CApplicationsPlugin* instance = CApplicationsPlugin::NewLC(); |
58 CApplicationsPlugin* instance = CApplicationsPlugin::NewLC(); |
52 CleanupStack::Pop(instance); |
59 CleanupStack::Pop(instance); |
|
60 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_NEWL_EXIT ); |
53 return instance; |
61 return instance; |
54 } |
62 } |
55 |
63 |
56 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
57 CApplicationsPlugin* CApplicationsPlugin::NewLC() |
65 CApplicationsPlugin* CApplicationsPlugin::NewLC() |
122 TBuf<KMaxFileName> temp;//we can reuse this. |
130 TBuf<KMaxFileName> temp;//we can reuse this. |
123 |
131 |
124 iWidgetRegistry.GetWidgetPath( aUid, temp ); |
132 iWidgetRegistry.GetWidgetPath( aUid, temp ); |
125 aDocument->AddFieldL(KApplicationFieldAbsolutePath, temp, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
133 aDocument->AddFieldL(KApplicationFieldAbsolutePath, temp, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
126 CPIXLOGSTRING2("AddApplicationInfo(): PATH = %S ", &temp); |
134 CPIXLOGSTRING2("AddApplicationInfo(): PATH = %S ", &temp); |
|
135 OstTraceExt1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;PATH=%S", &temp ); |
127 |
136 |
128 //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC |
137 //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC |
129 aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
138 aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
130 |
139 |
131 iWidgetRegistry.GetWidgetBundleName( aUid, temp ); |
140 iWidgetRegistry.GetWidgetBundleName( aUid, temp ); |
132 aDocument->AddExcerptL( temp ); |
141 aDocument->AddExcerptL( temp ); |
|
142 OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp ); |
133 CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp ); |
143 CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp ); |
134 } |
144 } |
135 |
145 |
136 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |
137 //This need not be a member function. |
147 //This need not be a member function. |
141 docidString = docidString.Mid( KUidStartIndex, KUidEndIndex ); |
151 docidString = docidString.Mid( KUidStartIndex, KUidEndIndex ); |
142 |
152 |
143 aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
153 aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
144 aDocument->AddFieldL(KApplicationFieldAbsolutePath, aAppInfo.iFullName, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
154 aDocument->AddFieldL(KApplicationFieldAbsolutePath, aAppInfo.iFullName, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
145 aDocument->AddExcerptL( aAppInfo.iCaption ); |
155 aDocument->AddExcerptL( aAppInfo.iCaption ); |
|
156 OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.iFullName ); |
|
157 OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); |
146 |
158 |
147 CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName ); |
159 CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName ); |
148 CPIXLOGSTRING3("AddApplicationInfo(): Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); |
160 CPIXLOGSTRING3("AddApplicationInfo(): Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); |
149 } |
161 } |
150 |
162 |
152 TBool CApplicationsPlugin::IsAppHiddenL(TUid aUid) |
164 TBool CApplicationsPlugin::IsAppHiddenL(TUid aUid) |
153 { |
165 { |
154 //Application should not have 'hidden' capability. |
166 //Application should not have 'hidden' capability. |
155 TBool ret( EFalse ); |
167 TBool ret( EFalse ); |
156 TApaAppCapabilityBuf cap; |
168 TApaAppCapabilityBuf cap; |
|
169 OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;UID=%d", aUid ); |
157 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid ); |
170 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid ); |
158 if ( iApplicationServerSession.GetAppCapability(cap, aUid) == KErrNone ) |
171 if ( iApplicationServerSession.GetAppCapability(cap, aUid) == KErrNone ) |
159 { |
172 { |
|
173 OstTraceState0( STATE_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "GetCapability returned KErrNone", "" ); |
|
174 |
160 CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone"); |
175 CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone"); |
161 ret = cap().iAppIsHidden; |
176 ret = cap().iAppIsHidden; |
162 } |
177 } |
163 |
178 |
164 //Application should not be listed hidden in application shell. |
179 //Application should not be listed hidden in application shell. |
175 // CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): UID in hidden app repository"); |
190 // CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): UID in hidden app repository"); |
176 // return EFalse; |
191 // return EFalse; |
177 // } |
192 // } |
178 // CleanupStack::PopAndDestroy( uidString ); |
193 // CleanupStack::PopAndDestroy( uidString ); |
179 // } |
194 // } |
|
195 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;Return Value=%d", &ret ); |
180 |
196 |
181 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret); |
197 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret); |
182 return ret; |
198 return ret; |
183 } |
199 } |
184 |
200 |
202 AddApplicationInfoL( document, aAppInfo ); |
218 AddApplicationInfoL( document, aAppInfo ); |
203 |
219 |
204 TRAPD( error, iIndexer->AddL( *document ) ); |
220 TRAPD( error, iIndexer->AddL( *document ) ); |
205 if( KErrNone == error ) |
221 if( KErrNone == error ) |
206 { |
222 { |
|
223 OstTrace0( TRACE_NORMAL, CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL : No Error" ); |
207 CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" ); |
224 CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" ); |
208 } |
225 } |
209 else |
226 else |
210 { |
227 { |
|
228 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL;Error=%d", error ); |
211 CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error ); |
229 CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error ); |
212 } |
230 } |
213 CleanupStack::PopAndDestroy( document ); |
231 CleanupStack::PopAndDestroy( document ); |
214 } |
232 } |
215 |
233 |
247 } |
265 } |
248 |
266 |
249 // ----------------------------------------------------------------------------- |
267 // ----------------------------------------------------------------------------- |
250 void CApplicationsPlugin::HandleAppListEvent( TInt aEvent ) |
268 void CApplicationsPlugin::HandleAppListEvent( TInt aEvent ) |
251 { |
269 { |
|
270 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_ENTRY ); |
|
271 OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT, "CApplicationsPlugin::HandleAppListEvent;Event=%d", aEvent ); |
252 CPIXLOGSTRING2("CApplicationsPlugin::HandleAppListEvent: Start with Event = %d", aEvent ); |
272 CPIXLOGSTRING2("CApplicationsPlugin::HandleAppListEvent: Start with Event = %d", aEvent ); |
253 if( aEvent == EAppListChanged ) |
273 if( aEvent == EAppListChanged ) |
254 { |
274 { |
255 if( iAsynchronizer->CallbackPending() ) |
275 if( iAsynchronizer->CallbackPending() ) |
256 { |
276 { |
257 iAsynchronizer->CancelCallback(); //first cancel any ongoing harvesting. |
277 iAsynchronizer->CancelCallback(); //first cancel any ongoing harvesting. |
258 } |
278 } |
259 TRAP_IGNORE( StartHarvestingL( KNullDesC ) ); //simply reharvest |
279 TRAP_IGNORE( StartHarvestingL( KNullDesC ) ); //simply reharvest |
260 } |
280 } |
261 CPIXLOGSTRING("CApplicationsPlugin::HandleAppListEvent: Exit" ); |
281 CPIXLOGSTRING("CApplicationsPlugin::HandleAppListEvent: Exit" ); |
|
282 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_EXIT ); |
262 } |
283 } |
263 |
284 |
264 #ifdef __PERFORMANCE_DATA |
285 #ifdef __PERFORMANCE_DATA |
265 void CApplicationsPlugin::UpdatePerformaceDataL() |
286 void CApplicationsPlugin::UpdatePerformaceDataL() |
266 { |
287 { |