75 { |
75 { |
76 } |
76 } |
77 |
77 |
78 // ----------------------------------------------------------------------------- |
78 // ----------------------------------------------------------------------------- |
79 CApplicationsPlugin::~CApplicationsPlugin() |
79 CApplicationsPlugin::~CApplicationsPlugin() |
80 { |
80 { |
|
81 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_CAPPLICATIONSPLUGIN_ENTRY ); |
|
82 |
81 if (iAsynchronizer) |
83 if (iAsynchronizer) |
82 iAsynchronizer->CancelCallback(); |
84 iAsynchronizer->CancelCallback(); |
83 iApplicationServerSession.Close(); |
85 //iApplicationServerSession.Close(); |
|
86 iScrView.Close(); |
|
87 iScrSession.Close(); |
84 //iWidgetRegistry.Close(); |
88 //iWidgetRegistry.Close(); |
85 //delete iHiddenApplicationsRepository; |
89 //delete iHiddenApplicationsRepository; |
86 delete iAsynchronizer; |
90 delete iAsynchronizer; |
87 delete iNotifier; |
91 delete iNotifier; |
88 delete iIndexer; |
92 delete iIndexer; |
89 } |
93 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_CAPPLICATIONSPLUGIN_EXIT ); |
|
94 } |
90 |
95 |
91 // ----------------------------------------------------------------------------- |
96 // ----------------------------------------------------------------------------- |
92 void CApplicationsPlugin::ConstructL() |
97 void CApplicationsPlugin::ConstructL() |
93 { |
98 { |
94 iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle ); |
99 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_CONSTRUCTL_ENTRY ); |
95 iNotifier = CApaAppListNotifier::NewL( this, CActive::EPriorityHigh ); |
100 iIndexState = ETrue; |
|
101 iAsynchronizer = CDelayedCallback::NewL(CActive::EPriorityIdle); |
|
102 iNotifier = CApaAppListNotifier::NewL(this, CActive::EPriorityHigh); |
96 //iHiddenApplicationsRepository = CRepository::NewL( KHiddenAppRepositoryUid ); |
103 //iHiddenApplicationsRepository = CRepository::NewL( KHiddenAppRepositoryUid ); |
97 //User::LeaveIfError( iWidgetRegistry.Connect() ); |
104 //User::LeaveIfError( iWidgetRegistry.Connect() ); |
|
105 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_CONSTRUCTL_EXIT ); |
98 } |
106 } |
99 |
107 |
100 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
101 void CApplicationsPlugin::StartPluginL() |
109 void CApplicationsPlugin::StartPluginL() |
102 { |
110 { |
103 User::LeaveIfError( iApplicationServerSession.Connect() ); |
111 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_STARTPLUGINL_ENTRY ); |
104 User::LeaveIfError(iSearchSession.DefineVolume( _L(APPLICATIONS_QBASEAPPCLASS), KNullDesC )); |
112 TRAPD(error,iScrSession.Connect()); |
105 |
113 if (error != KErrNone) |
106 // Open database |
114 return; |
107 iIndexer = CCPixIndexer::NewL(iSearchSession); |
115 |
108 iIndexer->OpenDatabaseL( _L(APPLICATIONS_QBASEAPPCLASS) ); |
116 User::LeaveIfError(iSearchSession.DefineVolume( |
109 |
117 _L(APPLICATIONS_QBASEAPPCLASS), KNullDesC)); |
110 // Start harvester for this plugin |
118 |
111 iObserver->AddHarvestingQueue( this, iIndexer->GetBaseAppClass() ); |
119 // Open database |
112 } |
120 iIndexer = CCPixIndexer::NewL(iSearchSession); |
|
121 iIndexer->OpenDatabaseL(_L(APPLICATIONS_QBASEAPPCLASS)); |
|
122 |
|
123 // Start harvester for this plugin |
|
124 iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass()); |
|
125 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_STARTPLUGINL_EXIT ); |
|
126 } |
113 |
127 |
114 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
115 void CApplicationsPlugin::StartHarvestingL(const TDesC& /* aQualifiedBaseAppClass */) |
129 void CApplicationsPlugin::StartHarvestingL(const TDesC& /* aQualifiedBaseAppClass */) |
116 { |
130 { |
117 // Harvest items on each call |
131 OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_STARTHARVESTINGL_ENTRY ); |
118 User::LeaveIfError( iApplicationServerSession.GetAllApps() );//if not KErrNone |
132 |
|
133 // Harvest items on each call |
|
134 iScrView.OpenViewL(iScrSession); |
119 iIndexer->ResetL(); |
135 iIndexer->ResetL(); |
|
136 iHarvestState = EHarvesterStartHarvest; |
120 //No need to check IsStatred() since this is the first start. |
137 //No need to check IsStatred() since this is the first start. |
121 #ifdef __PERFORMANCE_DATA |
138 #ifdef __PERFORMANCE_DATA |
122 iStartTime.UniversalTime(); |
139 iStartTime.UniversalTime(); |
123 #endif |
140 #endif |
124 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
141 iAsynchronizer->Start(0, this, KHarvestingDelay); |
125 } |
142 OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_STARTHARVESTINGL_EXIT ); |
126 |
143 } |
127 //Removing Widget Registry support |
|
128 /* ----------------------------------------------------------------------------- |
|
129 void CApplicationsPlugin::AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid ) |
|
130 { |
|
131 TBuf<KMaxFileName> temp;//we can reuse this. |
|
132 |
|
133 iWidgetRegistry.GetWidgetPath( aUid, temp ); |
|
134 aDocument->AddFieldL(KApplicationFieldAbsolutePath, temp, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
|
135 CPIXLOGSTRING2("AddApplicationInfo(): PATH = %S ", &temp); |
|
136 OstTraceExt1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;PATH=%S", &temp ); |
|
137 |
|
138 //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC |
|
139 aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
|
140 |
|
141 //For applications, no content to go into exceprt field. |
|
142 //For more info, check the appclass-hierarchy.txt |
|
143 //iWidgetRegistry.GetWidgetBundleName( aUid, temp ); |
|
144 //aDocument->AddExcerptL( temp ); |
|
145 aDocument->AddExcerptL( KNullDesC ); |
|
146 |
|
147 OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp ); |
|
148 CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp ); |
|
149 }*/ |
|
150 |
144 |
151 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
152 //This need not be a member function. |
146 //This need not be a member function. |
153 void AddApplicationInfoL( CSearchDocument* aDocument, TApaAppInfo& aAppInfo ) |
147 void AddApplicationInfoL(CSearchDocument* aDocument, |
154 { |
148 Usif::TAppRegInfo& aAppInfo) |
155 TBuf<KMaxFileName> docidString = aAppInfo.iUid.Name(); //This returns stuff in the form "[UID]". So remove the brackets. |
149 { |
156 docidString = docidString.Mid( KUidStartIndex, KUidEndIndex ); |
150 OstTraceFunctionEntry0( _ADDAPPLICATIONINFOL_ENTRY ); |
|
151 |
|
152 TBuf<KMaxFileName> docidString = aAppInfo.Uid().Name(); //This returns stuff in the form "[UID]". So remove the brackets. |
|
153 docidString = docidString.Mid(KUidStartIndex, KUidEndIndex); |
157 |
154 |
158 //We index the exe name (without extension), only if the title is not present. |
155 //We index the exe name (without extension), only if the title is not present. |
159 if( aAppInfo.iShortCaption.Compare(KNullDesC) ) |
156 if (aAppInfo.ShortCaption().Compare(KNullDesC)) |
160 { |
157 { |
161 aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
158 aDocument->AddFieldL(KApplicationFieldShortCaption, |
162 #ifdef USE_HIGHLIGHTER |
159 aAppInfo.ShortCaption(), CDocumentField::EStoreYes |
163 aDocument->AddHLDisplayFieldL(aAppInfo.iShortCaption); |
160 | CDocumentField::EIndexTokenized |
164 #endif |
161 | CDocumentField::EIndexFreeText); |
|
162 |
|
163 if (aAppInfo.Caption().Compare(KNullDesC)) |
|
164 { |
|
165 aDocument->AddFieldL(KApplicationFieldCaption, |
|
166 aAppInfo.Caption(), CDocumentField::EStoreYes |
|
167 | CDocumentField::EIndexTokenized |
|
168 | CDocumentField::EIndexFreeText); |
|
169 } |
|
170 |
|
171 aDocument->AddHLDisplayFieldL(aAppInfo.ShortCaption()); |
|
172 } |
|
173 else if (aAppInfo.Caption().Compare(KNullDesC)) |
|
174 { |
|
175 aDocument->AddFieldL(KApplicationFieldShortCaption, |
|
176 aAppInfo.Caption(), CDocumentField::EStoreYes |
|
177 | CDocumentField::EIndexTokenized |
|
178 | CDocumentField::EIndexFreeText); |
|
179 |
|
180 aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.Caption(), |
|
181 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized); |
165 } |
182 } |
166 else |
183 else |
167 { |
184 { |
168 //Find the *last* location of '\' and remove the .exe to get just the filename. |
185 //Find the *last* location of '\' and remove the .exe to get just the filename. |
169 TInt location = aAppInfo.iFullName.LocateReverse('\\'); |
186 TInt location = aAppInfo.FullName().LocateReverse('\\'); |
170 if( location > 0 ) |
187 if (location > 0) |
171 { |
188 { |
172 TInt lengthOfNameWithoutExtention = aAppInfo.iFullName.Length() -location -1; //-1 to increment one past '\'. |
189 TInt lengthOfNameWithoutExtention = aAppInfo.FullName().Length() |
173 TPtrC appName = aAppInfo.iFullName.Right( lengthOfNameWithoutExtention ); |
190 - location - 1; //-1 to increment one past '\'. |
174 aDocument->AddFieldL(KApplicationFieldAbsolutePath, appName.Left( appName.Length() -4 /*remove ".exe"*/), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); |
191 TPtrC appName = aAppInfo.FullName().Right( |
175 #ifdef USE_HIGHLIGHTER |
192 lengthOfNameWithoutExtention); |
176 aDocument->AddHLDisplayFieldL(appName.Left( appName.Length() -4 /*remove ".exe"*/)); |
193 aDocument->AddFieldL(KApplicationFieldShortCaption, appName.Left( |
177 #endif |
194 appName.Length() - 4 /*remove ".exe"*/), |
|
195 CDocumentField::EStoreYes |
|
196 | CDocumentField::EIndexTokenized); |
|
197 |
|
198 aDocument->AddFieldL(KApplicationFieldCaption, KNullDesC, |
|
199 CDocumentField::EStoreYes |
|
200 | CDocumentField::EIndexTokenized); |
|
201 |
|
202 aDocument->AddHLDisplayFieldL( |
|
203 appName.Left(appName.Length() - 4 /*remove ".exe"*/)); |
178 } |
204 } |
|
205 } |
|
206 |
|
207 if (aAppInfo.FullName().Compare(KNullDesC)) |
|
208 { |
|
209 aDocument->AddFieldL(KApplicationFieldAbsolutePath, |
|
210 aAppInfo.FullName(), CDocumentField::EStoreYes |
|
211 | CDocumentField::EIndexTokenized |
|
212 | CDocumentField::EAggregateNo); |
|
213 |
179 } |
214 } |
180 //For applications, no content to go into exceprt field, for more info, check the appclass-hierarchy.txt |
215 //For applications, no content to go into exceprt field, for more info, check the appclass-hierarchy.txt |
181 //aDocument->AddExcerptL( aAppInfo.iCaption ); |
216 //aDocument->AddExcerptL( aAppInfo.iCaption ); |
182 aDocument->AddExcerptL( KNullDesC ); |
217 aDocument->AddExcerptL(KNullDesC); |
183 |
218 |
184 OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.iFullName ); |
219 OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.FullName() ); |
185 OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); |
220 OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.Caption(), &aAppInfo.ShortCaption() ); |
186 |
221 OstTraceFunctionExit0( _ADDAPPLICATIONINFOL_EXIT ); |
187 CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName ); |
|
188 CPIXLOGSTRING3("AddApplicationInfo(): Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); |
|
189 } |
222 } |
190 |
223 |
191 // ----------------------------------------------------------------------------- |
224 // ----------------------------------------------------------------------------- |
192 TBool CApplicationsPlugin::IsAppHiddenL(TUid aUid) |
225 TBool CApplicationsPlugin::IsAppHiddenL(TUid aUid) |
193 { |
226 { |
194 //Application should not have 'hidden' capability. |
227 //Application should not have 'hidden' capability. |
195 TBool ret( EFalse ); |
228 TBool ret( EFalse ); |
196 TApaAppCapabilityBuf cap; |
|
197 OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;UID=%d", aUid ); |
229 OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;UID=%d", aUid ); |
198 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid ); |
230 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid ); |
199 if ( iApplicationServerSession.GetAppCapability(cap, aUid) == KErrNone ) |
231 |
200 { |
232 Usif::RRegistrationInfoForApplication appRegInfo; |
201 OstTraceState0( STATE_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "GetCapability returned KErrNone", "" ); |
233 appRegInfo.OpenL(iScrSession, aUid); |
202 |
234 Usif::TApplicationCharacteristics appCharacteristics; |
203 CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone"); |
235 appRegInfo.GetAppCharacteristicsL(appCharacteristics); |
204 ret = cap().iAppIsHidden; |
236 ret = appCharacteristics.iAppIsHidden; |
205 } |
237 appRegInfo.Close(); |
206 |
238 |
207 //This commented code is left here as the following functionality may need to be |
|
208 //returned if and when this or similar APIs are available for 10.1 |
|
209 |
|
210 //Application should not be listed hidden in application shell. |
|
211 // TBuf<NCentralRepositoryConstants::KMaxUnicodeStringLength> uidResult; |
|
212 // if( iHiddenApplicationsRepository->Get( KMenuHideApplication, uidResult ) == KErrNone ) |
|
213 // { |
|
214 // CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Hidden UIDs = %S", &uidResult ); |
|
215 // TBufC16<NCentralRepositoryConstants::KMaxUnicodeStringLength> buf(uidResult); |
|
216 // HBufC* uidString = buf.AllocLC(); |
|
217 // //If not in the list, it means it is hidden; so dont harvest |
|
218 // if( uidString->FindF( aUid.Name().Mid( KUidStartIndex, KUidEndIndex ) ) != KErrNotFound ) |
|
219 // { |
|
220 // CleanupStack::PopAndDestroy( uidString ); |
|
221 // CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): UID in hidden app repository"); |
|
222 // return EFalse; |
|
223 // } |
|
224 // CleanupStack::PopAndDestroy( uidString ); |
|
225 // } |
|
226 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;Return Value=%d", &ret ); |
239 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;Return Value=%d", &ret ); |
227 |
240 |
228 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret); |
241 CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret); |
229 return ret; |
242 return ret; |
230 } |
243 } |
231 |
244 |
232 // ----------------------------------------------------------------------------- |
245 // ----------------------------------------------------------------------------- |
233 void CApplicationsPlugin::CreateApplicationsIndexItemL( TApaAppInfo& aAppInfo, TCPixActionType /*aActionType*/ ) |
246 void CApplicationsPlugin::CreateApplicationsIndexItemL(RPointerArray< |
|
247 Usif::TAppRegInfo>& aAppInfo, TCPixActionType /*aActionType*/) |
234 { |
248 { |
235 //If application has 'hidden' capability, don't index. |
249 //If application has 'hidden' capability, don't index. |
236 if( IsAppHiddenL( aAppInfo.iUid ) ) return; |
250 for (TInt i = 0; i < aAppInfo.Count(); i++) |
237 |
251 { |
238 TBuf<KMaxFileName> docidString; |
252 if (!IsAppHiddenL(aAppInfo[i]->Uid())) |
239 docidString.Append( aAppInfo.iUid.Name() ); //This returns descriptor in the form "[UID]". So remove the brackets. |
253 { |
240 docidString = docidString.Mid( KUidStartIndex, KUidEndIndex ); |
254 OstTrace0( TRACE_NORMAL, DUP2_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::Indexing Application" ); |
241 |
255 |
242 CSearchDocument* document = CSearchDocument::NewLC( docidString, _L(APPLICATIONS_APPCLASS) ); |
256 TBuf<KMaxFileName> docidString; |
243 //The UID field should not be aggregated for now as we dont want it to be searchable by default. |
257 docidString.Append(aAppInfo[i]->Uid().Name()); //This returns descriptor in the form "[UID]". So remove the brackets. |
244 //By default, all tokenized fields are aggregated and therefore searchable. |
258 docidString = docidString.Mid(KUidStartIndex, KUidEndIndex); |
245 //If we dont tokenize, then the field will not be searchable at all. |
259 |
246 //As a middle path, we tokenize this field, but explicitly chose NOT to aggregate it. |
260 CSearchDocument* document = CSearchDocument::NewLC(docidString, |
247 //That way, if a client is interested in the UID field, he can choose to query it explicitly. |
261 _L(APPLICATIONS_APPCLASS)); |
248 document->AddFieldL(KMimeTypeField, KMimeTypeApplication, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized ); |
262 //The UID field should not be aggregated for now as we dont want it to be searchable by default. |
249 document->AddFieldL(KApplicationFieldUid, docidString, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EAggregateNo ); |
263 //By default, all tokenized fields are aggregated and therefore searchable. |
250 #ifdef USE_HIGHLIGHTER |
264 //If we dont tokenize, then the field will not be searchable at all. |
251 TInt excerptLength = docidString.Length(); |
265 //As a middle path, we tokenize this field, but explicitly chose NOT to aggregate it. |
252 HBufC* excerpt = HBufC::NewL(excerptLength); |
266 //That way, if a client is interested in the UID field, he can choose to query it explicitly. |
253 TPtr excerptPtr = excerpt->Des(); |
267 document->AddFieldL(KMimeTypeField, KMimeTypeApplication, |
254 CleanupStack::PushL(excerpt); |
268 CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
255 document->AddExcerptL(excerptPtr); |
269 document->AddFieldL(KApplicationFieldUid, docidString, |
256 CleanupStack::PopAndDestroy(excerpt); |
270 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized |
257 #endif |
271 | CDocumentField::EAggregateNo); |
258 |
272 |
259 /*if( iWidgetRegistry.IsWidget( aAppInfo.iUid ) ) //Widget support |
273 TInt excerptLength = docidString.Length(); |
260 AddWidgetInfoL( document, aAppInfo.iUid ); |
274 HBufC* excerpt = HBufC::NewL(excerptLength); |
261 else*/ |
275 TPtr excerptPtr = excerpt->Des(); |
262 AddApplicationInfoL( document, aAppInfo ); |
276 CleanupStack::PushL(excerpt); |
263 |
277 document->AddExcerptL(excerptPtr); |
264 TRAPD( error, iIndexer->AddL( *document ) ); |
278 CleanupStack::PopAndDestroy(excerpt); |
265 if( KErrNone == error ) |
279 |
266 { |
280 /*if( iWidgetRegistry.IsWidget( aAppInfo.iUid ) ) //Widget support |
267 OstTrace0( TRACE_NORMAL, CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL : No Error" ); |
281 AddWidgetInfoL( document, aAppInfo.iUid ); |
268 CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" ); |
282 else*/ |
269 } |
283 AddApplicationInfoL(document, *aAppInfo[i]); |
270 else |
284 TRAPD( error, iIndexer->AddL( *document ) ); |
271 { |
285 if (KErrNone == error) |
272 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL;Error=%d", error ); |
286 { |
273 CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error ); |
287 OstTrace0( TRACE_NORMAL, CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL : No Error" ); |
274 } |
288 CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" ); |
275 CleanupStack::PopAndDestroy( document ); |
289 } |
|
290 else |
|
291 { |
|
292 OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL;Error=%d", error ); |
|
293 CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error ); |
|
294 } |
|
295 CleanupStack::PopAndDestroy(document); |
|
296 } |
|
297 } |
276 } |
298 } |
277 |
299 |
278 // ----------------------------------------------------------------------------- |
300 // ----------------------------------------------------------------------------- |
279 void CApplicationsPlugin::DelayedCallbackL( TInt /*aCode*/ ) |
301 void CApplicationsPlugin::DelayedCallbackL( TInt /*aCode*/ ) |
280 { |
302 { |
281 TApaAppInfo appInfo; |
303 if( !iIndexState ) |
282 const TInt error = iApplicationServerSession.GetNextApp( appInfo ); |
304 return; |
283 if( error == KErrNone ) |
305 |
|
306 RPointerArray<Usif::TAppRegInfo> appInfo; |
|
307 //const TInt error = iApplicationServerSession.GetNextApp(appInfo); |
|
308 iScrView.GetNextAppInfoL(KNumberOfAppInfoToBeRead, appInfo); |
|
309 if (appInfo.Count() > 0) |
284 { |
310 { |
285 CreateApplicationsIndexItemL( appInfo, ECPixAddAction ); |
311 CreateApplicationsIndexItemL( appInfo, ECPixAddAction ); |
286 } |
312 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
287 |
313 } |
288 if ( error != RApaLsSession::ENoMoreAppsInList ) |
314 else |
289 { |
315 { |
290 //No need to check IsStatred() since control reaches |
316 OstTrace0( TRACE_NORMAL, CAPPLICATIONSPLUGIN_DELAYEDCALLBACKL, "CApplicationsPlugin::DelayedCallbackL:Flushing" ); |
291 //here only on asynchornize complete. |
317 |
292 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
318 Flush(*iIndexer); |
293 } |
|
294 else |
|
295 { |
|
296 Flush( *iIndexer ); |
|
297 #ifdef __PERFORMANCE_DATA |
319 #ifdef __PERFORMANCE_DATA |
298 UpdatePerformaceDataL(); |
320 UpdatePerformaceDataL(); |
299 #endif |
321 #endif |
|
322 iHarvestState = EHarvesterIdleState; |
300 iObserver->HarvestingCompleted( this, iIndexer->GetBaseAppClass(), KErrNone ); |
323 iObserver->HarvestingCompleted( this, iIndexer->GetBaseAppClass(), KErrNone ); |
301 } |
324 } |
302 } |
325 appInfo.ResetAndDestroy(); |
|
326 } |
303 |
327 |
304 // ----------------------------------------------------------------------------- |
328 // ----------------------------------------------------------------------------- |
305 void CApplicationsPlugin::DelayedError( TInt aCode ) |
329 void CApplicationsPlugin::DelayedError( TInt aCode ) |
306 { |
330 { |
307 Flush(*iIndexer); |
331 Flush(*iIndexer); |
|
332 iHarvestState = EHarvesterIdleState; |
308 iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aCode); |
333 iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aCode); |
309 } |
334 } |
310 |
335 |
311 // ----------------------------------------------------------------------------- |
336 // ----------------------------------------------------------------------------- |
312 void CApplicationsPlugin::HandleAppListEvent( TInt aEvent ) |
337 void CApplicationsPlugin::HandleAppListEvent( TInt aEvent ) |