activityfw/storage/server/src/afapplicationsstorage.cpp
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    15 *
    15 *
    16 */
    16 */
    17 #include "afapplicationsstorage.h"
    17 #include "afapplicationsstorage.h"
    18 //------------------------------------------------------------------------------
    18 //------------------------------------------------------------------------------
    19 CAfApplicationsStorage* CAfApplicationsStorage::NewL(CAfStorage& storage, 
    19 CAfApplicationsStorage* CAfApplicationsStorage::NewL(CAfStorage& storage, 
    20                                                      const MAfApplicationsRegistry& provider)
    20                                                      const MAfApplicationsRegistry& provider, 
       
    21                                                      MAfApplicationsObserver &observer)
    21 {
    22 {
    22     CAfApplicationsStorage *self = new (ELeave)CAfApplicationsStorage(storage, provider);
    23     CAfApplicationsStorage *self = new (ELeave)CAfApplicationsStorage(storage, provider, observer);
    23     return self;
    24     return self;
    24     
    25     
    25 }
    26 }
    26 
    27 
    27 //------------------------------------------------------------------------------
    28 //------------------------------------------------------------------------------
    28 CAfApplicationsStorage::CAfApplicationsStorage(CAfStorage& storage, 
    29 CAfApplicationsStorage::CAfApplicationsStorage(CAfStorage& storage, 
    29                                                const MAfApplicationsRegistry& provider)
    30                                                const MAfApplicationsRegistry& provider, 
       
    31                                                MAfApplicationsObserver &observer)
    30 :
    32 :
    31     mStorage(storage),
    33     mStorage(storage),
    32     mProvider(provider)
    34     mProvider(provider),
       
    35     mObserver(observer)
    33 {
    36 {
    34 }
    37 }
    35 
    38 
    36 //------------------------------------------------------------------------------
    39 //------------------------------------------------------------------------------
    37 CAfApplicationsStorage::~CAfApplicationsStorage()
    40 CAfApplicationsStorage::~CAfApplicationsStorage()
    42 {
    45 {
    43     const TArray<TUid> removedApp(mProvider.removedApplications());
    46     const TArray<TUid> removedApp(mProvider.removedApplications());
    44     for (TInt iter(0); iter < removedApp.Count(); ++iter) {
    47     for (TInt iter(0); iter < removedApp.Count(); ++iter) {
    45         TRAP_IGNORE(deleteActivityL(removedApp[iter]));
    48         TRAP_IGNORE(deleteActivityL(removedApp[iter]));
    46     }
    49     }
       
    50 
       
    51     if ( removedApp.Count() > 0 ) {
       
    52         mObserver.applicationsChanged();
       
    53     }
    47 }
    54 }
    48 
    55 
    49 //------------------------------------------------------------------------------
    56 //------------------------------------------------------------------------------
    50 void CAfApplicationsStorage::deleteActivityL(TUid appId)
    57 void CAfApplicationsStorage::deleteActivityL(TUid appId)
    51 {
    58 {
    53                                     static_cast<TInt>(appId.iUid),
    60                                     static_cast<TInt>(appId.iUid),
    54                                     KNullDesC,
    61                                     KNullDesC,
    55                                     KNullDesC,
    62                                     KNullDesC,
    56                                     KNullDesC,
    63                                     KNullDesC,
    57                                     KNullDesC8,
    64                                     KNullDesC8,
    58                                     KNullDesC8));
    65                                     KNullDesC8,
       
    66                                     TTime()));
    59     mStorage.DeleteActivitiesL(*entry);
    67     mStorage.DeleteActivitiesL(*entry);
    60     CleanupStack::PopAndDestroy(entry);
    68     CleanupStack::PopAndDestroy(entry);
    61 }
    69 }