activityfw/storage/server/src/afapplicationsengine.cpp
changeset 124 e36b2f4799c0
parent 109 e0aa398e6810
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    16 */
    16 */
    17 #include "afapplicationsengine.h"
    17 #include "afapplicationsengine.h"
    18 #include "afapplicationsstorage.h"
    18 #include "afapplicationsstorage.h"
    19 #include "afapplicationscollection.h"
    19 #include "afapplicationscollection.h"
    20 #include "afapplicationsmonitor.h"
    20 #include "afapplicationsmonitor.h"
       
    21 #include "aftaskstorage.h"
       
    22 #include "aftask.h"
    21 
    23 
    22 //------------------------------------------------------------------------------
    24 //------------------------------------------------------------------------------
    23 CAfApplicationsEngine* CAfApplicationsEngine::NewL(RApaLsSession& serviceProvider, 
    25 CAfApplicationsEngine* CAfApplicationsEngine::NewL(RApaLsSession& serviceProvider, 
    24                                                    CAfStorage& storage)
    26                                                    CAfStorage& storage, 
       
    27                                                    MAfTaskStorage& taskStorage)
    25 {
    28 {
    26     CAfApplicationsEngine *self = new(ELeave)CAfApplicationsEngine();
    29     CAfApplicationsEngine *self = new(ELeave)CAfApplicationsEngine(taskStorage);
    27     CleanupStack::PushL(self);
    30     CleanupStack::PushL(self);
    28     self->ConstructL(storage, serviceProvider);
    31     self->ConstructL(serviceProvider, storage);
    29     CleanupStack::Pop(self);
    32     CleanupStack::Pop(self);
    30     return self;
    33     return self;
    31 }
    34 }
    32 
    35 
    33 //------------------------------------------------------------------------------
    36 //------------------------------------------------------------------------------
    34 CAfApplicationsEngine::CAfApplicationsEngine()
    37 CAfApplicationsEngine::CAfApplicationsEngine(MAfTaskStorage& taskStorage) :
    35 {}
    38     mTaskStorage(taskStorage)
       
    39 {
       
    40 }
    36 
    41 
    37 //------------------------------------------------------------------------------
    42 //------------------------------------------------------------------------------
    38 void CAfApplicationsEngine::ConstructL(CAfStorage& storage, 
    43 void CAfApplicationsEngine::ConstructL(RApaLsSession& serviceProvider,
    39                                        RApaLsSession& serviceProvider)
    44                                        CAfStorage& storage)
    40 {
    45 {
    41     mCollection = CAfApplicationsCollection::NewL(serviceProvider);
    46     mCollection = CAfApplicationsCollection::NewL(serviceProvider);
    42     mMonitor = CAfApplicationsMonitor::NewL(serviceProvider, *mCollection);
    47     mMonitor = CAfApplicationsMonitor::NewL(serviceProvider, *mCollection);
    43     mStorage = CAfApplicationsStorage::NewL(storage, *mCollection);
    48     mStorage = CAfApplicationsStorage::NewL(storage, *mCollection, *this);
    44     
    49     
    45     mCollection->setObserver(*mStorage);
    50     mCollection->setObserver(*mStorage);
    46 }
    51 }
    47 
    52 
    48 //------------------------------------------------------------------------------
    53 //------------------------------------------------------------------------------
    50 {
    55 {
    51     delete mMonitor;
    56     delete mMonitor;
    52     delete mStorage;
    57     delete mStorage;
    53     delete mCollection;
    58     delete mCollection;
    54 }
    59 }
       
    60 
       
    61 //------------------------------------------------------------------------------
       
    62 void CAfApplicationsEngine::applicationsChanged()
       
    63 {
       
    64     const RPointerArray<CAfTask> &table(mTaskStorage.StorageData());
       
    65     for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
       
    66         table[iter]->BroadcastReceivedL(RMessage2(), ETrue);
       
    67     }
       
    68 }