79 CleanupStack::Pop( scanner ); |
82 CleanupStack::Pop( scanner ); |
80 return scanner; |
83 return scanner; |
81 } |
84 } |
82 |
85 |
83 // --------------------------------------------------------- |
86 // --------------------------------------------------------- |
84 // CCaSrvAppScanner::~CCaSrvAppScanner |
87 // |
85 // --------------------------------------------------------- |
88 // --------------------------------------------------------- |
86 // |
89 // |
87 CCaSrvAppScanner::~CCaSrvAppScanner() |
90 CCaSrvAppScanner::~CCaSrvAppScanner() |
88 { |
91 { |
89 Cancel(); |
92 Cancel(); |
|
93 iSoftwareRegistry.Close(); |
90 iApaLsSession.Close(); |
94 iApaLsSession.Close(); |
91 iInstalledPackages.Close(); |
95 iInstalledPackages.Close(); |
92 delete iInstallNotifier; |
96 delete iInstallNotifier; |
93 delete iNotifier; |
97 delete iNotifier; |
94 delete iMmcHistory; |
98 delete iMmcHistory; |
95 iFs.Close(); |
99 iFs.Close(); |
96 } |
100 } |
97 |
101 |
98 // --------------------------------------------------------- |
102 // --------------------------------------------------------- |
99 // CCaSrvAppScanner::CCaSrvAppScanner |
103 // |
100 // --------------------------------------------------------- |
104 // --------------------------------------------------------- |
101 // |
105 // |
102 CCaSrvAppScanner::CCaSrvAppScanner( CCaStorageProxy& aCaStorageProxy, |
106 CCaSrvAppScanner::CCaSrvAppScanner( CCaStorageProxy& aCaStorageProxy, |
103 CCaSrvEngUtils& aUtils ) : |
107 CCaSrvEngUtils& aUtils ) : |
104 CActive( CActive::EPriorityStandard ), |
108 CActive( CActive::EPriorityStandard ), |
106 { |
110 { |
107 CActiveScheduler::Add( this ); |
111 CActiveScheduler::Add( this ); |
108 } |
112 } |
109 |
113 |
110 // --------------------------------------------------------- |
114 // --------------------------------------------------------- |
111 // CCaSrvAppScanner::ConstructL |
115 // |
112 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
113 // |
117 // |
114 void CCaSrvAppScanner::ConstructL() |
118 void CCaSrvAppScanner::ConstructL() |
115 { |
119 { |
116 User::LeaveIfError( iFs.Connect() ); |
120 User::LeaveIfError( iFs.Connect() ); |
117 TFileName path; |
121 TFileName path; |
118 User::LeaveIfError( iFs.PrivatePath( path ) ); |
122 User::LeaveIfError( iFs.PrivatePath( path ) ); |
119 TUint attribute; |
123 TUint attribute; |
120 if( iFs.Att( path, attribute) == KErrNotFound ) |
124 if( iFs.Att( path, attribute ) == KErrNotFound ) |
121 { |
125 { |
122 TInt mdRes = iFs.MkDirAll( path ); |
126 TInt mdRes = iFs.MkDirAll( path ); |
123 if ( mdRes != KErrNone ) |
127 if ( mdRes != KErrNone ) |
124 { |
128 { |
125 User::Leave( mdRes ); |
129 User::Leave( mdRes ); |
126 } |
130 } |
127 } |
131 } |
128 iMmcHistory = new (ELeave) CCaSrvMmcHistory(); |
132 iMmcHistory = CCaSrvMmcHistory::NewL(); |
129 iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() ); |
133 iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() ); |
130 // The notifier has its own session to apparc, instead of taking |
|
131 // it as argument... :( |
|
132 iNotifier = CApaAppListNotifier::NewL( |
134 iNotifier = CApaAppListNotifier::NewL( |
133 this, CActive::EPriorityStandard ); |
135 this, CActive::EPriorityStandard ); |
134 iInstallNotifier = CCaInstallNotifier::NewL( |
136 iInstallNotifier = CCaInstallNotifier::NewL( |
135 *this, CCaInstallNotifier::ESisInstallNotification ); |
137 *this, CCaInstallNotifier::ESisInstallNotification ); |
136 |
138 |
137 User::LeaveIfError( iApaLsSession.Connect() ); |
139 User::LeaveIfError( iApaLsSession.Connect() ); |
138 User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async. |
140 User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async. |
|
141 User::LeaveIfError( iSoftwareRegistry.Connect() ); |
139 iApaLsSession.RegisterListPopulationCompleteObserver( iStatus ); |
142 iApaLsSession.RegisterListPopulationCompleteObserver( iStatus ); |
140 iCollectionDownloadId = 0; |
143 iCollectionDownloadId = 0; |
141 iAllCollectionId = 0; |
144 iAllCollectionId = 0; |
142 SetActive(); |
145 SetActive(); |
143 } |
146 } |
144 |
147 |
145 // --------------------------------------------------------- |
148 // --------------------------------------------------------- |
146 // CCaSrvAppScanner::RunL |
149 // |
147 // --------------------------------------------------------- |
150 // --------------------------------------------------------- |
148 // |
151 // |
149 void CCaSrvAppScanner::RunL() |
152 void CCaSrvAppScanner::RunL() |
150 { |
153 { |
151 User::LeaveIfError( iStatus.Int() ); // Handle errors in RunL. |
154 User::LeaveIfError( iStatus.Int() ); |
152 // AppArc app scan complete, we have the app list. |
155 // AppArc app scan complete, we have the app list. |
153 UpdateApplicationEntriesL(); |
156 UpdateApplicationEntriesL(); |
154 InstallationNotifyL(); |
157 InstallationNotifyL(); |
155 MakeNotEmptyCollectionsVisibleL(); |
158 MakeNotEmptyCollectionsVisibleL(); |
156 } |
159 } |
157 |
160 |
158 // --------------------------------------------------------- |
161 // --------------------------------------------------------- |
159 // CCaSrvAppScanner::DoCancel |
162 // |
160 // --------------------------------------------------------- |
163 // --------------------------------------------------------- |
161 // |
164 // |
162 void CCaSrvAppScanner::DoCancel() |
165 void CCaSrvAppScanner::DoCancel() |
163 { |
166 { |
164 iApaLsSession.CancelListPopulationCompleteObserver(); |
167 iApaLsSession.CancelListPopulationCompleteObserver(); |
165 } |
168 } |
166 |
169 |
167 // --------------------------------------------------------- |
170 // --------------------------------------------------------- |
168 // CCaSrvAppScanner::RunError |
171 // |
169 // --------------------------------------------------------- |
172 // --------------------------------------------------------- |
170 // |
173 // |
171 TInt CCaSrvAppScanner::RunError( TInt /*aError*/) |
174 TInt CCaSrvAppScanner::RunError( TInt /*aError*/) |
172 { |
175 { |
173 // Ignore the error (what else could we do?). |
176 // Ignore the error (what else could we do?). |
174 // When next AppArc update occurs, we will run again. |
177 // When next update occurs, we will run again. |
175 return KErrNone; |
178 return KErrNone; |
176 } |
179 } |
177 |
180 |
178 // --------------------------------------------------------- |
181 // --------------------------------------------------------- |
179 // CCaSrvAppScanner::UpdateApplicationItemL |
182 // |
180 // --------------------------------------------------------- |
183 // --------------------------------------------------------- |
181 // |
184 // |
182 void CCaSrvAppScanner::UpdateApplicationEntryL( |
185 void CCaSrvAppScanner::UpdateApplicationEntryL( |
183 RPointerArray<CCaInnerEntry>& aCaEntries, |
186 RPointerArray<CCaInnerEntry>& aCaEntries, |
184 const TCaAppAtributes& aApaItem, TUint aMmcId ) |
187 TUint aAppUid, TUint aMmcId ) |
185 { |
188 { |
186 TInt appuid = aApaItem.GetUid(); |
|
187 RPointerArray<CCaInnerEntry> resultArray; |
189 RPointerArray<CCaInnerEntry> resultArray; |
188 CleanupResetAndDestroyPushL( resultArray ); |
190 CleanupResetAndDestroyPushL( resultArray ); |
189 GetCaAppEntriesL( appuid, resultArray ); |
191 GetCaAppEntriesL( aAppUid, resultArray ); |
190 |
192 |
191 // This app is not in the storage, add it now. |
193 // This app is not in the storage, add it now. |
192 // We don't add hidden items, there are too many of them! |
194 // We don't add hidden items, there are too many of them! |
193 // do not display Menu app |
195 // do not display Menu app |
194 if( !resultArray.Count() ) |
196 if( !resultArray.Count() ) |
195 { |
197 { |
196 AddAppEntryL( appuid, aMmcId ); |
198 AddAppEntryL( aAppUid, aMmcId ); |
197 }//if |
199 }//if |
198 |
200 |
199 // "removable", "missing" and "visible" flags update |
201 // "removable", "missing" and "visible" flags update |
200 for( TInt j = 0; j < resultArray.Count(); j++ ) |
202 for( TInt j = 0; j < resultArray.Count(); j++ ) |
201 { |
203 { |
202 //we need to handle first run of appscanner, |
204 //We need to handle first run of appscanner, |
203 //there might be some incorrect data in content xml file |
205 //there might be some incorrect data. If this will have impact |
204 //if this will have impact on performance we may run this methods only at start up |
206 //on performance we may run this methods only at start up. |
205 |
207 |
206 UpdateAppEntryL( resultArray[j], aMmcId ); |
208 UpdateAppEntryL( resultArray[j], aMmcId ); |
207 TInt index = aCaEntries.Find( resultArray[j], |
209 TInt index = aCaEntries.Find( resultArray[j], |
208 TIdentityRelation<CCaInnerEntry>( IdMatch ) ); |
210 TIdentityRelation<CCaInnerEntry>( IdMatch ) ); |
209 if( index != KErrNotFound ) |
211 if( index != KErrNotFound ) |
214 }//for |
216 }//for |
215 CleanupStack::PopAndDestroy( &resultArray ); |
217 CleanupStack::PopAndDestroy( &resultArray ); |
216 } |
218 } |
217 |
219 |
218 // --------------------------------------------------------- |
220 // --------------------------------------------------------- |
219 // CCaSrvAppScanner::UpdateAppEntryL |
221 // |
220 // --------------------------------------------------------- |
222 // --------------------------------------------------------- |
221 // |
223 // |
222 void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId ) |
224 void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId ) |
223 { |
225 { |
224 TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); |
226 TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); |
225 TBool missingVisibleFlagChanged = |
227 TBool missingVisibleFlagChanged = |
226 HandleMissingVisibleFlagsUpdate( aEntry ); |
228 HandleMissingVisibleFlagsUpdate( aEntry ); |
227 toUpdate = missingVisibleFlagChanged || toUpdate; |
229 toUpdate = missingVisibleFlagChanged || toUpdate; |
228 toUpdate = HandleLockDeleteFlagUpdateL( aEntry ) || toUpdate; |
230 toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate; |
229 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
231 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
230 |
232 |
231 if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound ) |
233 if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound ) |
232 { |
234 { |
233 AddEntryToDownloadedCollectionL( aEntry->GetId() ); |
235 AddEntryToDownloadedCollectionL( aEntry->GetId() ); |
234 toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate; |
236 toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate; |
235 AddEntryToPredefinedCollectionL( aEntry, ETrue ); |
237 AddEntryToPredefinedCollectionL( aEntry, ETrue ); |
244 } |
246 } |
245 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
247 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
246 RemoveFromInstalledPackages( aEntry->GetUid() ); |
248 RemoveFromInstalledPackages( aEntry->GetUid() ); |
247 } |
249 } |
248 } |
250 } |
249 // --------------------------------------------------------- |
251 |
250 // |
252 // --------------------------------------------------------- |
251 // --------------------------------------------------------- |
253 // |
252 // |
|
253 TBool CCaSrvAppScanner::HandleVisibleFlagUpdate( CCaInnerEntry* aItem ) |
|
254 { |
|
255 TBool toChange( EFalse ); |
|
256 if( !( aItem->GetFlags() & EVisible ) ) |
|
257 { |
|
258 aItem->SetFlags( aItem->GetFlags() | EVisible ); |
|
259 toChange = ETrue; |
|
260 } |
|
261 return toChange; |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------- |
|
265 // |
|
266 // --------------------------------------------------------- |
|
267 // |
|
268 TBool CCaSrvAppScanner::HandleUsedFlagUpdate( CCaInnerEntry* aItem ) |
|
269 { |
|
270 TBool changed( EFalse ); |
|
271 if( aItem->GetFlags() & EUsed ) |
|
272 { |
|
273 aItem->SetFlags( aItem->GetFlags() & ~EUsed ); |
|
274 changed = ETrue; |
|
275 } |
|
276 return changed; |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------- |
|
280 // CCaSrvAppScanner::HandleMmcAttrUpdateL |
|
281 // --------------------------------------------------------- |
254 // --------------------------------------------------------- |
282 // |
255 // |
283 TBool CCaSrvAppScanner::HandleMmcAttrUpdateL( |
256 TBool CCaSrvAppScanner::HandleMmcAttrUpdateL( |
284 CCaInnerEntry* aItem, TUint aMmcId ) |
257 CCaInnerEntry* aItem, TUint aMmcId ) |
285 { |
258 { |
286 TBool toUpdate( ETrue ); |
259 TBool toUpdate( ETrue ); |
287 if( IsInMmcL( TUid::Uid( aItem->GetUid() ) ) ) |
260 if( IsInMmcL( TUid::Uid( aItem->GetUid() ) ) ) |
288 { |
261 { |
289 //app is instaled on mmc - KCaAttrMmcId attribute update |
262 //app is instaled on mmc - KCaAttrMmcId attribute update |
290 TBuf<KUidChars> uidString; |
263 RBuf uidString; |
|
264 uidString.CleanupClosePushL(); |
|
265 uidString.CreateL(KUidChars); |
291 uidString.Format( KHexFormat, aMmcId ); |
266 uidString.Format( KHexFormat, aMmcId ); |
292 aItem->AddAttributeL( KCaAttrMmcId, uidString ); |
267 aItem->AddAttributeL( KCaAttrMmcId, uidString ); |
|
268 CleanupStack::PopAndDestroy( &uidString ); |
293 } |
269 } |
294 else if ( IsInMassStorageL( TUid::Uid( aItem->GetUid() ) ) ) |
270 else if ( IsInMassStorageL( TUid::Uid( aItem->GetUid() ) ) ) |
295 { |
271 { |
296 //its app installed on mass storage, we need to leave it |
272 //its app installed on mass storage, we need to leave it |
297 //in case of connecting usb in mass storage mode |
273 //in case of connecting usb in mass storage mode |
341 CleanupResetAndDestroyPushL( resultArray ); |
317 CleanupResetAndDestroyPushL( resultArray ); |
342 GetCaAppEntriesL( resultArray ); |
318 GetCaAppEntriesL( resultArray ); |
343 HandleHsAppEntryL( resultArray ); |
319 HandleHsAppEntryL( resultArray ); |
344 RemoveSatAppL( resultArray ); |
320 RemoveSatAppL( resultArray ); |
345 |
321 |
346 RArray<TCaAppAtributes> apaItems; |
322 RArray<TUint> appUids; |
347 CleanupClosePushL( apaItems ); |
323 CleanupClosePushL( appUids ); |
348 GetApaItemsL( apaItems ); |
324 GetApaItemsL( appUids ); |
349 RemoveApp( apaItems, KSatUid.iUid ); |
325 RemoveApp( appUids, KSatUid.iUid ); |
350 RemoveApp( apaItems, KHsAppUid.iUid ); |
326 RemoveApp( appUids, KHsAppUid.iUid ); |
351 |
327 |
352 //for every item in apaAndCrItems array |
328 //for every item in apaAndCrItems array |
353 for( TInt i = 0; i < apaItems.Count(); i++ ) |
329 for( TInt i = 0; i < appUids.Count(); i++ ) |
354 { |
330 { |
355 // if there was leave for any item we ignore it |
331 // if there was leave for any item we ignore it |
356 // and proceed to the next one |
332 // and proceed to the next one |
357 TRAP_IGNORE(UpdateApplicationEntryL( |
333 TRAP_IGNORE(UpdateApplicationEntryL( |
358 resultArray, apaItems[i], currentMmcId)); |
334 resultArray, appUids[i], currentMmcId)); |
359 } |
335 } |
360 // Here the big list cwith items that refer to missing apps. |
336 // Here the big list with items that refer to missing apps. |
361 HandleMissingItemsL( resultArray ); |
337 HandleMissingItemsL( resultArray ); |
362 CleanupStack::PopAndDestroy( &apaItems ); |
338 CleanupStack::PopAndDestroy( &appUids ); |
363 CleanupStack::PopAndDestroy( &resultArray ); |
339 CleanupStack::PopAndDestroy( &resultArray ); |
364 } |
340 } |
365 |
341 |
366 // --------------------------------------------------------- |
342 // --------------------------------------------------------- |
367 // CCaSrvAppScanner::HandleLockDeleteFlagUpdateL |
343 // |
368 // --------------------------------------------------------- |
344 // --------------------------------------------------------- |
369 // |
345 // |
370 TBool CCaSrvAppScanner::HandleLockDeleteFlagUpdateL( CCaInnerEntry* aItem ) |
346 TBool CCaSrvAppScanner::HandleRemovableVisibleFlagsUpdateL( |
|
347 CCaInnerEntry* aItem ) |
371 { |
348 { |
372 TBool toChange( EFalse ); |
349 TBool toChange( EFalse ); |
373 TBool isVisible = ( ( aItem->GetFlags() & EVisible ) != 0 ); |
350 if( ( aItem->GetFlags() & EVisible ) && IsInRomL( aItem->GetUid() ) ) |
374 if( isVisible && IsInRomL( aItem->GetUid() ) ) |
|
375 { |
351 { |
376 if( ( aItem->GetFlags() & ERemovable ) != 0 ) |
352 if( ( aItem->GetFlags() & ERemovable ) != 0 ) |
377 { |
353 { |
378 aItem->SetFlags( aItem->GetFlags() & ~ERemovable ); |
354 aItem->SetFlags( aItem->GetFlags() & ~ERemovable ); |
379 toChange = ETrue; |
355 toChange = ETrue; |
406 } |
383 } |
407 return ret; |
384 return ret; |
408 } |
385 } |
409 |
386 |
410 // --------------------------------------------------------- |
387 // --------------------------------------------------------- |
411 // CCaSrvAppScanner::RemoveApp |
388 // |
412 // --------------------------------------------------------- |
389 // --------------------------------------------------------- |
413 // |
390 // |
414 void CCaSrvAppScanner::RemoveApp( RArray<TCaAppAtributes>& aArray, TInt32 aUid ) |
391 TBool CCaSrvAppScanner::HandleVisibleFlagUpdate( CCaInnerEntry* aItem ) |
415 { |
392 { |
416 TCaAppAtributes app( aUid ); |
393 TBool toChange( EFalse ); |
417 TInt id = aArray.Find( app, TCaAppAtributes::MatchItems ); |
394 if( !( aItem->GetFlags() & EVisible ) ) |
|
395 { |
|
396 aItem->SetFlags( aItem->GetFlags() | EVisible ); |
|
397 toChange = ETrue; |
|
398 } |
|
399 return toChange; |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------- |
|
403 // |
|
404 // --------------------------------------------------------- |
|
405 // |
|
406 TBool CCaSrvAppScanner::HandleUsedFlagUpdate( CCaInnerEntry* aItem ) |
|
407 { |
|
408 TBool changed( EFalse ); |
|
409 if( aItem->GetFlags() & EUsed ) |
|
410 { |
|
411 aItem->SetFlags( aItem->GetFlags() & ~EUsed ); |
|
412 changed = ETrue; |
|
413 } |
|
414 return changed; |
|
415 } |
|
416 |
|
417 // --------------------------------------------------------- |
|
418 // |
|
419 // --------------------------------------------------------- |
|
420 // |
|
421 void CCaSrvAppScanner::RemoveApp( RArray<TUint>& aArray, TInt32 aUid ) |
|
422 { |
|
423 TInt id = aArray.Find( aUid ); |
418 if( id != KErrNotFound ) |
424 if( id != KErrNotFound ) |
419 { |
425 { |
420 aArray.Remove( id ); |
426 aArray.Remove( id ); |
421 } |
427 } |
422 } |
428 } |
423 |
429 |
424 // --------------------------------------------------------- |
430 // --------------------------------------------------------- |
425 // CCaSrvAppScanner::RemoveSatApp |
431 // |
426 // --------------------------------------------------------- |
432 // --------------------------------------------------------- |
427 // |
433 // |
428 void CCaSrvAppScanner::RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray ) |
434 void CCaSrvAppScanner::RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray ) |
429 { |
435 { |
430 CCaInnerEntry* sat = CCaInnerEntry::NewL(); |
436 CCaInnerEntry* sat = CCaInnerEntry::NewL(); |
493 User::LeaveIfError( iApaLsSession.GetAppCapability( |
500 User::LeaveIfError( iApaLsSession.GetAppCapability( |
494 appCap, appInfo->iUid ) ); |
501 appCap, appInfo->iUid ) ); |
495 // "Hidden" status according to AppArc. |
502 // "Hidden" status according to AppArc. |
496 if( !appCap().iAppIsHidden ) |
503 if( !appCap().iAppIsHidden ) |
497 { |
504 { |
498 TCaAppAtributes appAtributes( appInfo->iUid.iUid ); |
505 aArray.AppendL( appInfo->iUid.iUid ); |
499 aArray.AppendL( appAtributes ); |
|
500 } |
506 } |
501 } |
507 } |
502 CleanupStack::PopAndDestroy(appInfo); |
508 CleanupStack::PopAndDestroy(appInfo); |
503 } |
509 } |
504 |
510 |
505 // --------------------------------------------------------- |
511 // --------------------------------------------------------- |
506 // CCaSrvAppScanner::GetMcsItemsL |
512 // |
507 // --------------------------------------------------------- |
513 // --------------------------------------------------------- |
508 // |
514 // |
509 void CCaSrvAppScanner::GetCaAppEntriesL( |
515 void CCaSrvAppScanner::GetCaAppEntriesL( |
510 RPointerArray<CCaInnerEntry>& aArray ) |
516 RPointerArray<CCaInnerEntry>& aArray ) |
511 { |
517 { |
512 CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC(); |
518 CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC(); |
513 CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( 1 ); |
519 CDesC16ArrayFlat* appType = |
|
520 new ( ELeave ) CDesC16ArrayFlat( KGranularityOne ); |
514 CleanupStack::PushL( appType ); |
521 CleanupStack::PushL( appType ); |
515 appType->AppendL( KCaTypeApp ); |
522 appType->AppendL( KCaTypeApp ); |
516 allAppQuery->SetEntryTypeNames( appType ); |
523 allAppQuery->SetEntryTypeNames( appType ); |
517 CleanupStack::Pop( appType ); |
524 CleanupStack::Pop( appType ); |
518 iCaStorageProxy.GetEntriesL( allAppQuery, aArray ); |
525 iCaStorageProxy.GetEntriesL( allAppQuery, aArray ); |
519 CleanupStack::PopAndDestroy( allAppQuery ); |
526 CleanupStack::PopAndDestroy( allAppQuery ); |
520 } |
527 } |
521 |
528 |
522 // --------------------------------------------------------- |
529 // --------------------------------------------------------- |
523 // CCaSrvAppScanner::GetMcsItemsL |
530 // |
524 // --------------------------------------------------------- |
531 // --------------------------------------------------------- |
525 // |
532 // |
526 TInt CCaSrvAppScanner::GetCollectionDownloadIdL() |
533 TInt CCaSrvAppScanner::GetCollectionDownloadIdL() |
527 { |
534 { |
528 if( iCollectionDownloadId == 0 ) |
535 if( iCollectionDownloadId == 0 ) |
529 { |
536 { |
530 RPointerArray<CCaInnerEntry> resultArray; |
537 RPointerArray<CCaInnerEntry> resultArray; |
531 CleanupResetAndDestroyPushL( resultArray ); |
538 CleanupResetAndDestroyPushL( resultArray ); |
532 CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC(); |
539 CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC(); |
533 CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( 1 ); |
540 CDesC16ArrayFlat* appType = |
|
541 new ( ELeave ) CDesC16ArrayFlat( KGranularityOne ); |
534 CleanupStack::PushL( appType ); |
542 CleanupStack::PushL( appType ); |
535 appType->AppendL( KCaTypeCollectionDownload ); |
543 appType->AppendL( KCaTypeCollectionDownload ); |
536 allAppQuery->SetEntryTypeNames( appType ); |
544 allAppQuery->SetEntryTypeNames( appType ); |
537 CleanupStack::Pop( appType ); |
545 CleanupStack::Pop( appType ); |
538 iCaStorageProxy.GetEntriesL( allAppQuery, resultArray ); |
546 iCaStorageProxy.GetEntriesL( allAppQuery, resultArray ); |
602 ScheduleScan(); |
610 ScheduleScan(); |
603 } |
611 } |
604 } |
612 } |
605 |
613 |
606 // --------------------------------------------------------- |
614 // --------------------------------------------------------- |
607 // CCaSrvAppScanner::HandleInstallNotifyL |
615 // |
608 // --------------------------------------------------------- |
616 // --------------------------------------------------------- |
609 // |
617 // |
610 void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid ) |
618 void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid ) |
611 { |
619 { |
612 NotifyL( aUid ); |
620 NotifyL( aUid ); |
613 RArray<TUid> uids; |
621 RArray<TUid> uids; |
614 CleanupClosePushL( uids ); |
622 CleanupClosePushL( uids ); |
615 |
623 |
616 Swi::RSisRegistrySession iSisRegSession; |
624 Swi::RSisRegistrySession iSisRegSession; |
|
625 CleanupClosePushL( iSisRegSession ); |
617 User::LeaveIfError( iSisRegSession.Connect() ); |
626 User::LeaveIfError( iSisRegSession.Connect() ); |
618 CleanupClosePushL( iSisRegSession ); |
|
619 |
627 |
620 // Open sis package entry related to aUid |
628 // Open sis package entry related to aUid |
621 Swi::RSisRegistryEntry packageEntry; |
629 Swi::RSisRegistryEntry packageEntry; |
622 if( KErrNone |
630 if( KErrNone |
623 == packageEntry.Open( iSisRegSession, TUid::Uid( aUid ) ) ) |
631 == packageEntry.Open( iSisRegSession, TUid::Uid( aUid ) ) ) |
624 { |
632 { |
625 CleanupClosePushL( packageEntry ); |
633 CleanupClosePushL( packageEntry ); |
626 |
634 |
627 // Get packageEntry's embedded sis' |
635 // Get packageEntry's embedded sis' |
628 RPointerArray<Swi::CSisRegistryPackage> embedded; |
636 RPointerArray<Swi::CSisRegistryPackage> embedded; |
629 CleanupClosePushL( embedded ); |
637 CleanupResetAndDestroyPushL( embedded ); |
630 packageEntry.EmbeddedPackagesL( embedded ); |
638 packageEntry.EmbeddedPackagesL( embedded ); |
631 if( embedded.Count() ) |
639 if( embedded.Count() ) |
632 { |
640 { |
633 // For each embadded sis we notify storage - recursive call |
641 // For each embadded sis we notify storage - recursive call |
634 for( TInt i = 0; i < embedded.Count(); ++i ) |
642 for( TInt i = 0; i < embedded.Count(); ++i ) |
670 } |
677 } |
671 CleanupStack::PopAndDestroy( &sids ); |
678 CleanupStack::PopAndDestroy( &sids ); |
672 } |
679 } |
673 |
680 |
674 // --------------------------------------------------------- |
681 // --------------------------------------------------------- |
675 // CCaSrvAppScanner::NotifyL |
682 // |
676 // --------------------------------------------------------- |
683 // --------------------------------------------------------- |
677 // |
684 // |
678 void CCaSrvAppScanner::NotifyL( TInt aAppUid ) |
685 void CCaSrvAppScanner::NotifyL( TInt aAppUid ) |
679 { |
686 { |
680 // Get entries for given aAppUid |
687 // Get entries for given aAppUid |
681 RPointerArray<CCaInnerEntry> resultArray; |
688 RPointerArray<CCaInnerEntry> resultArray; |
682 CleanupResetAndDestroyPushL( resultArray ); |
689 CleanupResetAndDestroyPushL( resultArray ); |
683 GetCaAppEntriesL( aAppUid, resultArray ); |
690 GetCaAppEntriesL( aAppUid, resultArray ); |
684 if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) ) |
691 if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) ) |
685 {//TODO: this only for icons. This functionality should be change |
692 {//TODO: this only for icons. This functionality should be change |
686 iCaStorageProxy.AddL( resultArray[0] ); |
693 iCaStorageProxy.AddL( resultArray[0] ); |
687 } |
694 } |
688 CleanupStack::PopAndDestroy( &resultArray ); |
695 CleanupStack::PopAndDestroy( &resultArray ); |
689 } |
696 } |
690 |
697 |
691 // --------------------------------------------------------- |
698 // --------------------------------------------------------- |
692 // CCaSrvAppScanner::AddEntryToDownloadedCollectionL |
699 // |
693 // --------------------------------------------------------- |
700 // --------------------------------------------------------- |
694 // |
701 // |
695 void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId ) |
702 void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId ) |
696 { |
703 { |
697 TCaOperationParams params = { TCaOperationParams::EPrepend, GetCollectionDownloadIdL(), 0 // not used |
704 TCaOperationParams params; |
698 }; |
705 params.iOperationType = TCaOperationParams::EPrepend; |
|
706 params.iGroupId = GetCollectionDownloadIdL(); |
|
707 params.iBeforeEntryId = 0; // Not used. |
699 |
708 |
700 RArray<TInt> entryIds; |
709 RArray<TInt> entryIds; |
701 CleanupClosePushL( entryIds ); |
710 CleanupClosePushL( entryIds ); |
702 entryIds.AppendL( aEntryId ); |
711 entryIds.AppendL( aEntryId ); |
703 iCaStorageProxy.OrganizeL( entryIds, params ); |
712 iCaStorageProxy.OrganizeL( entryIds, params ); |
704 |
713 |
705 CleanupStack::PopAndDestroy( &entryIds ); |
714 CleanupStack::PopAndDestroy( &entryIds ); |
706 } |
715 } |
707 |
716 |
708 // --------------------------------------------------------- |
717 // --------------------------------------------------------- |
709 // CCaSrvAppScanner::AddEntryToPredefinedCollectionL |
718 // |
710 // --------------------------------------------------------- |
719 // --------------------------------------------------------- |
711 // |
720 // |
712 void CCaSrvAppScanner::AddEntryToPredefinedCollectionL( |
721 void CCaSrvAppScanner::AddEntryToPredefinedCollectionL( |
713 CCaInnerEntry* aEntry, TBool aUpdate ) |
722 CCaInnerEntry* aEntry, TBool aUpdate ) |
714 { |
723 { |
753 // add new collection to all collection |
762 // add new collection to all collection |
754 AddCollectionToAllCollectionL( predefinedCollectionId ); |
763 AddCollectionToAllCollectionL( predefinedCollectionId ); |
755 |
764 |
756 if( aUpdate ) |
765 if( aUpdate ) |
757 { |
766 { |
758 organizeParams.iOperationType = TCaOperationParams::EAppend; |
|
759 iCaStorageProxy.OrganizeL( entryIds, organizeParams ); |
767 iCaStorageProxy.OrganizeL( entryIds, organizeParams ); |
760 } |
768 } |
761 } |
769 } |
762 |
770 |
763 if( !aUpdate ) |
771 if( !aUpdate ) |
764 { |
772 { |
765 organizeParams.iOperationType = TCaOperationParams::EAppend; |
|
766 iCaStorageProxy.OrganizeL( entryIds, organizeParams ); |
773 iCaStorageProxy.OrganizeL( entryIds, organizeParams ); |
767 } |
774 } |
768 |
775 |
769 CleanupStack::PopAndDestroy( &entryIds ); |
776 CleanupStack::PopAndDestroy( &entryIds ); |
770 CleanupStack::PopAndDestroy( &resultArrayItems ); |
777 CleanupStack::PopAndDestroy( &resultArrayItems ); |
771 CleanupStack::PopAndDestroy( innerQuery ); |
778 CleanupStack::PopAndDestroy( innerQuery ); |
772 } |
779 } |
773 } |
780 } |
774 |
781 |
775 // --------------------------------------------------------- |
782 // --------------------------------------------------------- |
776 // CCaSrvAppScanner::CreatePredefinedCollectionL |
783 // |
777 // --------------------------------------------------------- |
784 // --------------------------------------------------------- |
778 // |
785 // |
779 TInt CCaSrvAppScanner::CreatePredefinedCollectionL( const TDesC& aGroupName ) |
786 TInt CCaSrvAppScanner::CreatePredefinedCollectionL( const TDesC& aGroupName ) |
780 { |
787 { |
781 CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); |
788 CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); |
782 innerEntry->SetTextL( aGroupName ); |
789 innerEntry->SetTextL( aGroupName ); |
783 innerEntry->SetEntryTypeNameL( KCaTypeCollection ); |
790 innerEntry->SetEntryTypeNameL( KCaTypeCollection ); |
784 innerEntry->SetRole( CCaInnerQuery::Group ); |
791 innerEntry->SetRole( CCaInnerQuery::Group ); |
785 innerEntry->AddAttributeL( KCaAppGroupName, aGroupName ); |
792 innerEntry->AddAttributeL( KCaAppGroupName, aGroupName ); |
786 innerEntry->SetFlags( EVisible ); |
793 innerEntry->SetFlags( EVisible | ERemovable ); |
787 innerEntry->SetFlags( innerEntry->GetFlags() | ERemovable ); |
|
788 _LIT( KCollectionIconFileName, "qtg_large_applications_user"); |
|
789 innerEntry->SetIconDataL( KCollectionIconFileName, |
794 innerEntry->SetIconDataL( KCollectionIconFileName, |
790 KNullDesC, KNullDesC ); |
795 KNullDesC, KNullDesC ); |
791 iCaStorageProxy.AddL( innerEntry ); |
796 iCaStorageProxy.AddL( innerEntry ); |
792 // Get new collection Id |
797 // Get new collection Id |
793 TInt newCollectionId = innerEntry->GetId(); |
798 TInt newCollectionId = innerEntry->GetId(); |
815 } |
820 } |
816 |
821 |
817 |
822 |
818 |
823 |
819 // --------------------------------------------------------- |
824 // --------------------------------------------------------- |
820 // CCaSrvAppScanner::RemoveToDownloadedCollectionL |
825 // |
821 // --------------------------------------------------------- |
826 // --------------------------------------------------------- |
822 // |
827 // |
823 void CCaSrvAppScanner::RemoveEntryFromDownloadedL( TInt aEntryId ) |
828 void CCaSrvAppScanner::RemoveEntryFromDownloadedL( TInt aEntryId ) |
824 { |
829 { |
825 TCaOperationParams params = { TCaOperationParams::ERemove, GetCollectionDownloadIdL(), 0 // not used |
830 TCaOperationParams params; |
826 }; |
831 params.iOperationType = TCaOperationParams::ERemove; |
|
832 params.iGroupId = GetCollectionDownloadIdL(); |
|
833 params.iBeforeEntryId = 0; // Not Used |
827 |
834 |
828 RArray<TInt> entryIds; |
835 RArray<TInt> entryIds; |
829 CleanupClosePushL( entryIds ); |
836 CleanupClosePushL( entryIds ); |
830 entryIds.AppendL( aEntryId ); |
837 entryIds.AppendL( aEntryId ); |
831 iCaStorageProxy.OrganizeL( entryIds, params ); |
838 iCaStorageProxy.OrganizeL( entryIds, params ); |
832 |
839 |
833 CleanupStack::PopAndDestroy( &entryIds ); |
840 CleanupStack::PopAndDestroy( &entryIds ); |
834 } |
841 } |
835 |
842 |
836 // --------------------------------------------------------- |
843 // --------------------------------------------------------- |
837 // CCaSrvAppScanner::ScheduleScan |
844 // |
838 // --------------------------------------------------------- |
845 // --------------------------------------------------------- |
839 // |
846 // |
840 void CCaSrvAppScanner::ScheduleScan() |
847 void CCaSrvAppScanner::ScheduleScan() |
841 { |
848 { |
842 if( !IsActive() ) |
849 if( !IsActive() ) |
861 appEntry->SetUid( aUid ); |
868 appEntry->SetUid( aUid ); |
862 appEntry->SetFlags( EVisible ); |
869 appEntry->SetFlags( EVisible ); |
863 appEntry->SetRole( EItemEntryRole ); |
870 appEntry->SetRole( EItemEntryRole ); |
864 |
871 |
865 SetApaAppInfoL( appEntry ); |
872 SetApaAppInfoL( appEntry ); |
866 HandleLockDeleteFlagUpdateL( appEntry ); |
873 HandleRemovableVisibleFlagsUpdateL( appEntry ); |
867 HandleMmcAttrUpdateL( appEntry, aCurrentMmcId ); |
874 HandleMmcAttrUpdateL( appEntry, aCurrentMmcId ); |
868 |
875 |
869 iCaStorageProxy.AddL( appEntry ); |
876 iCaStorageProxy.AddL( appEntry ); |
870 |
877 |
871 AddEntryToPredefinedCollectionL( appEntry ); |
878 AddEntryToPredefinedCollectionL( appEntry ); |
872 |
879 |
873 if( iInstalledPackages.Find( aUid ) != KErrNotFound ) |
880 if( iInstalledPackages.Find( aUid ) != KErrNotFound ) |
874 { |
881 { |
875 AddEntryToDownloadedCollectionL( appEntry->GetId() ); |
882 AddEntryToDownloadedCollectionL( appEntry->GetId() ); |
876 } |
883 RemoveFromInstalledPackages( aUid ); |
877 RemoveFromInstalledPackages( aUid ); |
884 } |
878 |
885 |
879 CleanupStack::PopAndDestroy( appEntry ); |
886 CleanupStack::PopAndDestroy( appEntry ); |
880 } |
887 } |
881 |
888 |
882 // --------------------------------------------------------- |
889 // --------------------------------------------------------- |
883 // CCaSrvAppScanner::RemoveFromInstalledPackages |
890 // |
884 // --------------------------------------------------------- |
891 // --------------------------------------------------------- |
885 // |
892 // |
886 void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid ) |
893 void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid ) |
887 { |
894 { |
888 TInt appIndex = iInstalledPackages.Find( aUid ); |
895 TInt appIndex = iInstalledPackages.Find( aUid ); |
891 iInstalledPackages.Remove( appIndex ); |
898 iInstalledPackages.Remove( appIndex ); |
892 } |
899 } |
893 } |
900 } |
894 |
901 |
895 // --------------------------------------------------------------------------- |
902 // --------------------------------------------------------------------------- |
896 // CCaSrvAppScanner::IsMidletL |
903 // |
897 // Checks if given app is midlet by reading the apptype uid (2nd uid) |
|
898 // --------------------------------------------------------------------------- |
904 // --------------------------------------------------------------------------- |
899 // |
905 // |
900 TBool CCaSrvAppScanner::SetApaAppInfoL( CCaInnerEntry* aEntry ) |
906 TBool CCaSrvAppScanner::SetApaAppInfoL( CCaInnerEntry* aEntry ) |
901 { |
907 { |
902 TBool changed( EFalse ); |
908 TBool changed( EFalse ); |
903 TApaAppInfo info; |
909 TApaAppInfo* info = new ( ELeave ) TApaAppInfo(); |
904 if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, info ) ) |
910 CleanupStack::PushL(info); |
|
911 if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) ) |
905 { |
912 { |
906 RBuf attrVal; |
913 RBuf attrVal; |
907 attrVal.CleanupClosePushL(); |
914 attrVal.CleanupClosePushL(); |
908 attrVal.CreateL( KCaMaxAttrValueLen ); |
915 attrVal.CreateL( KCaMaxAttrValueLen ); |
909 aEntry->FindAttribute( KCaAttrLongName, attrVal ); |
916 aEntry->FindAttribute( KCaAttrLongName, attrVal ); |
910 if( attrVal.Compare( info.iCaption ) != KErrNone |
917 if( attrVal.Compare( info->iCaption ) != KErrNone |
911 || aEntry->GetText().Compare( info.iCaption ) |
918 || aEntry->GetText().Compare( info->iCaption ) |
912 != KErrNone ) |
919 != KErrNone ) |
913 { |
920 { |
914 aEntry->SetTextL( info.iCaption ); |
921 aEntry->SetTextL( info->iCaption ); |
915 aEntry->AddAttributeL( KCaAttrLongName, info.iCaption ); |
922 aEntry->AddAttributeL( KCaAttrLongName, info->iCaption ); |
916 changed = ETrue; |
923 changed = ETrue; |
917 } |
924 } |
|
925 |
|
926 |
|
927 if ( UpdateComponentIdL( *info, *aEntry ) ) |
|
928 { |
|
929 changed = ETrue; |
|
930 } |
|
931 |
918 CleanupStack::PopAndDestroy( &attrVal ); |
932 CleanupStack::PopAndDestroy( &attrVal ); |
919 // check if its java app and add attr for entrys |
933 |
|
934 // check if its java app and add attr for entries |
920 TUid appTypeUid; |
935 TUid appTypeUid; |
921 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info.iUid ) ) |
936 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) ) |
922 { |
937 { |
923 if( appTypeUid == KMidletApplicationTypeUid ) |
938 if( appTypeUid == KMidletApplicationTypeUid ) |
924 { |
939 { |
925 aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava ); |
940 aEntry->AddAttributeL( |
926 aEntry->AddAttributeL( KCaAttrAppSettingsPlugin, KCaAttrJavaAppSettingsPluginValue ); |
941 KCaAttrAppType, |
|
942 KCaAttrAppTypeValueJava ); |
|
943 aEntry->AddAttributeL( |
|
944 KCaAttrAppSettingsPlugin, |
|
945 KCaAttrJavaAppSettingsPluginValue ); |
927 } |
946 } |
928 else if (appTypeUid == KCWRTApplicationTypeUid) |
947 else if (appTypeUid == KCWRTApplicationTypeUid) |
929 { |
948 { |
930 aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT ); |
949 aEntry->AddAttributeL( |
931 aEntry->AddAttributeL( KCaAttrAppWidgetUri, KCaAttrAppWidgetUriCWRTValue ); |
950 KCaAttrAppType, |
|
951 KCaAttrAppTypeValueCWRT ); |
|
952 aEntry->AddAttributeL( |
|
953 KCaAttrAppWidgetUri, |
|
954 KCaAttrAppWidgetUriCWRTValue ); |
932 // web id should be taken from SCR when supported |
955 // web id should be taken from SCR when supported |
933 RWidgetRegistryClientSession wrtSession; |
956 RWidgetRegistryClientSession wrtSession; |
934 CleanupClosePushL(wrtSession); |
957 CleanupClosePushL(wrtSession); |
935 User::LeaveIfError( wrtSession.Connect()); |
958 User::LeaveIfError( wrtSession.Connect()); |
936 TFileName bundleId; |
959 TFileName bundleId; |
937 wrtSession.GetWidgetBundleId(info.iUid, bundleId); |
960 wrtSession.GetWidgetBundleId(info->iUid, bundleId); |
938 aEntry->AddAttributeL( KCaAttrAppWidgetParamWebAppId, bundleId ); |
961 aEntry->AddAttributeL( |
|
962 KCaAttrAppWidgetParamWebAppId, |
|
963 bundleId ); |
939 CleanupStack::PopAndDestroy(&wrtSession); |
964 CleanupStack::PopAndDestroy(&wrtSession); |
940 } |
965 } |
941 } |
966 } |
942 } |
967 } |
|
968 CleanupStack::PopAndDestroy( info ); |
943 return changed; |
969 return changed; |
944 } |
970 } |
945 |
971 |
946 // --------------------------------------------------------- |
972 // --------------------------------------------------------- |
947 // CCaSrvAppScanner::HandleMissingItemsL |
973 // |
948 // --------------------------------------------------------- |
974 // --------------------------------------------------------- |
949 // |
975 // |
950 void CCaSrvAppScanner::HandleMissingItemsL( |
976 void CCaSrvAppScanner::HandleMissingItemsL( |
951 RPointerArray<CCaInnerEntry>& aCaEntries ) |
977 RPointerArray<CCaInnerEntry>& aCaEntries ) |
952 { |
978 { |
953 for( TInt i = 0; i < aCaEntries.Count(); i++ ) |
979 for( TInt i = 0; i < aCaEntries.Count(); i++ ) |
954 { |
980 { |
955 const TInt id = aCaEntries[i]->GetId(); |
|
956 RBuf attrVal; |
981 RBuf attrVal; |
957 attrVal.CleanupClosePushL(); |
982 attrVal.CleanupClosePushL(); |
958 attrVal.CreateL( KCaMaxAttrValueLen ); |
983 attrVal.CreateL( KCaMaxAttrValueLen ); |
959 if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) ) |
984 if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) ) |
960 { |
985 { |
1061 } |
1089 } |
1062 return mmcId; |
1090 return mmcId; |
1063 } |
1091 } |
1064 |
1092 |
1065 // --------------------------------------------------------- |
1093 // --------------------------------------------------------- |
1066 // CCaSrvAppScanner::IsFileInDrive |
1094 // |
1067 // --------------------------------------------------------- |
1095 // --------------------------------------------------------- |
1068 // |
1096 // |
1069 TBool CCaSrvAppScanner::IsFileInDrive( |
1097 TBool CCaSrvAppScanner::IsFileInDrive( |
1070 const TDesC& aFileName, |
1098 const TDesC& aFileName, |
1071 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
1099 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
1072 { |
1100 { |
1073 if ( aFileName.Length() ) |
1101 TBool retVal( EFalse ); |
1074 { |
1102 if ( aFileName.Length()>0 ) |
1075 TInt mmcDrive; |
1103 { |
|
1104 TInt mmcDrive; |
1076 TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, mmcDrive ); |
1105 TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, mmcDrive ); |
1077 if( !err ) |
1106 if( !err ) |
1078 { |
1107 { |
1079 TInt fileDrive; |
1108 TInt fileDrive; |
1080 err = RFs::CharToDrive( aFileName[0], fileDrive ); |
1109 err = RFs::CharToDrive( aFileName[0], fileDrive ); |
1081 if( !err && fileDrive == mmcDrive ) |
1110 if( !err && fileDrive == mmcDrive ) |
1082 { |
1111 { |
1083 return ETrue; |
1112 retVal = ETrue; |
1084 } |
1113 } |
1085 } |
1114 } |
1086 } |
1115 } |
1087 return EFalse; |
1116 return retVal; |
1088 } |
1117 } |
1089 |
1118 |
1090 // --------------------------------------------------------- |
1119 // --------------------------------------------------------- |
1091 // CCaSrvAppScanner::IsAppInDriveL |
1120 // |
1092 // --------------------------------------------------------- |
1121 // --------------------------------------------------------- |
1093 // |
1122 // |
1094 TBool CCaSrvAppScanner::IsAppInDriveL( |
1123 TBool CCaSrvAppScanner::IsAppInDriveL( |
1095 const TUid aUid, |
1124 const TUid aUid, |
1096 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
1125 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
1097 { |
1126 { |
1098 TBool ret( EFalse ); |
1127 TBool ret( EFalse ); |
1099 TApaAppInfo* appInfo = new( ELeave ) TApaAppInfo(); |
1128 TApaAppInfo* appInfo = new ( ELeave ) TApaAppInfo(); |
1100 TInt err = iApaLsSession.GetAppInfo( *appInfo, aUid ); |
1129 TInt err = iApaLsSession.GetAppInfo( *appInfo, aUid ); |
1101 if( !err && IsFileInDrive( appInfo->iFullName, aDefaultDrive ) ) |
1130 if( !err && IsFileInDrive( appInfo->iFullName, aDefaultDrive ) ) |
1102 { |
1131 { |
1103 ret = ETrue; |
1132 ret = ETrue; |
1104 } |
1133 } |
1105 delete appInfo; |
1134 delete appInfo; |
1106 return ret; |
1135 return ret; |
1107 } |
1136 } |
1108 |
1137 |
1109 // --------------------------------------------------------- |
1138 // --------------------------------------------------------- |
1110 // CCaSrvAppScanner::IsInMmcL |
1139 // |
1111 // --------------------------------------------------------- |
1140 // --------------------------------------------------------- |
1112 // |
1141 // |
1113 TBool CCaSrvAppScanner::IsInMmcL( const TUid aUid ) const |
1142 TBool CCaSrvAppScanner::IsInMmcL( const TUid aUid ) const |
1114 { |
1143 { |
1115 return IsAppInDriveL( aUid, DriveInfo::EDefaultRemovableMassStorage ); |
1144 return IsAppInDriveL( aUid, DriveInfo::EDefaultRemovableMassStorage ); |
1116 } |
1145 } |
1117 |
1146 |
1118 // --------------------------------------------------------- |
1147 // --------------------------------------------------------- |
1119 // CCaSrvAppScanner::IsInMassStorageL |
1148 // |
1120 // --------------------------------------------------------- |
1149 // --------------------------------------------------------- |
1121 // |
1150 // |
1122 TBool CCaSrvAppScanner::IsInMassStorageL( const TUid aUid ) const |
1151 TBool CCaSrvAppScanner::IsInMassStorageL( const TUid aUid ) const |
1123 { |
1152 { |
1124 return IsAppInDriveL( aUid, DriveInfo::EDefaultMassStorage ); |
1153 return IsAppInDriveL( aUid, DriveInfo::EDefaultMassStorage ); |
1125 } |
1154 } |
1126 |
1155 |
1127 // --------------------------------------------------------- |
1156 // --------------------------------------------------------- |
1128 // CCaSrvAppScanner::IsInRomL |
1157 // |
1129 // --------------------------------------------------------- |
1158 // --------------------------------------------------------- |
1130 // |
1159 // |
1131 TBool CCaSrvAppScanner::IsInRomL( TInt aUid ) |
1160 TBool CCaSrvAppScanner::IsInRomL( TInt aUid ) |
1132 { |
1161 { |
1133 return IsAppInDriveL( TUid::Uid( aUid ), DriveInfo::EDefaultRom ); |
1162 return IsAppInDriveL( TUid::Uid( aUid ), DriveInfo::EDefaultRom ); |
1134 } |
1163 } |
1135 |
1164 |
1136 // --------------------------------------------------------- |
1165 // --------------------------------------------------------- |
1137 // CCaSrvAppScanner::IsDriveInUse |
1166 // |
1138 // --------------------------------------------------------- |
1167 // --------------------------------------------------------- |
1139 // |
1168 // |
1140 TBool CCaSrvAppScanner::IsDriveInUse( |
1169 TBool CCaSrvAppScanner::IsDriveInUse( |
1141 const DriveInfo::TDefaultDrives& aDefaultDrive ) |
1170 const DriveInfo::TDefaultDrives& aDefaultDrive ) |
1142 { |
1171 { |
1203 } |
1240 } |
1204 CleanupStack::PopAndDestroy( visibleEntriesQuery ); |
1241 CleanupStack::PopAndDestroy( visibleEntriesQuery ); |
1205 CleanupStack::PopAndDestroy( &resultEntriesArray ); |
1242 CleanupStack::PopAndDestroy( &resultEntriesArray ); |
1206 } |
1243 } |
1207 |
1244 |
1208 |
1245 // --------------------------------------------------------- |
1209 // ==================== MEMBER FUNCTIONS ==================== |
1246 // |
1210 |
1247 // ---------------------------------------------------------// |
1211 // --------------------------------------------------------- |
1248 TBool CCaSrvAppScanner::UpdateComponentIdL( TApaAppInfo& appInfo, |
1212 // TAppAtributes::TAppAtributes |
1249 CCaInnerEntry& aEntry ) const |
1213 // --------------------------------------------------------- |
1250 { |
1214 // |
1251 TBool updated( EFalse ); |
1215 TCaAppAtributes::TCaAppAtributes( TUint aUid ) |
1252 |
1216 { |
1253 CComponentFilter* const fileNameFilter = CComponentFilter::NewLC(); |
1217 iUid = aUid; |
1254 |
1218 } |
1255 fileNameFilter->SetFileL( appInfo.iFullName ); |
1219 |
1256 |
1220 // --------------------------------------------------------- |
1257 RArray<TComponentId> componentIds; |
1221 // TAppAtributes::GetUid |
1258 CleanupClosePushL( componentIds ); |
1222 // --------------------------------------------------------- |
1259 iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter ); |
1223 // |
1260 |
1224 TUint TCaAppAtributes::GetUid() const |
1261 if ( componentIds.Count() == 0 ) |
1225 { |
1262 { |
1226 return iUid; |
1263 CComponentFilter* const uidFilter = CComponentFilter::NewLC(); |
1227 } |
1264 uidFilter->AddPropertyL(_L("Uid"), aEntry.GetUid()); |
1228 |
1265 iSoftwareRegistry.GetComponentIdsL( componentIds, uidFilter ); |
1229 // --------------------------------------------------------- |
1266 CleanupStack::PopAndDestroy( uidFilter ); |
1230 // TAppAtributes::MatchItems |
1267 } |
1231 // --------------------------------------------------------- |
1268 |
1232 // |
1269 if ( componentIds.Count() == 1 ) |
1233 TBool TCaAppAtributes::MatchItems( const TCaAppAtributes& item1, |
1270 { |
1234 const TCaAppAtributes& item2 ) |
1271 RBuf newComponentId; |
1235 { |
1272 newComponentId.CleanupClosePushL(); |
1236 return item1.GetUid() == item2.GetUid(); |
1273 newComponentId.CreateL( sizeof(TComponentId) + 1 ); |
1237 } |
1274 newComponentId.AppendNum( componentIds[0] ); |
1238 |
1275 |
|
1276 RBuf oldComponentId; |
|
1277 oldComponentId.CleanupClosePushL(); |
|
1278 oldComponentId.CreateL( KCaMaxAttrValueLen ); |
|
1279 |
|
1280 const TBool componentIdAttributeFound = |
|
1281 aEntry.FindAttribute( KCaComponentId, oldComponentId ); |
|
1282 |
|
1283 if ( !componentIdAttributeFound |
|
1284 || oldComponentId.Compare( newComponentId ) != 0 ) |
|
1285 { |
|
1286 // 'add' or 'update' the component id attribute value |
|
1287 aEntry.AddAttributeL( KCaComponentId, |
|
1288 newComponentId ); |
|
1289 |
|
1290 updated = ETrue; |
|
1291 } |
|
1292 |
|
1293 CleanupStack::PopAndDestroy( &oldComponentId ); |
|
1294 CleanupStack::PopAndDestroy( &newComponentId ); |
|
1295 } |
|
1296 |
|
1297 CleanupStack::PopAndDestroy( &componentIds ); |
|
1298 CleanupStack::PopAndDestroy( fileNameFilter ); |
|
1299 |
|
1300 return updated; |
|
1301 } |