profilesservices/ProfileEngine/WrapperSrc/CProEngNotifyHandlerImpl.cpp
changeset 21 851e19007849
parent 18 e3554c9069b6
child 29 56ba5cd39aab
equal deleted inserted replaced
19:30540fccecae 21:851e19007849
    28 #include    <MProEngActiveProfileObserver.h>
    28 #include    <MProEngActiveProfileObserver.h>
    29 #include    <MProEngProfileObserver.h>
    29 #include    <MProEngProfileObserver.h>
    30 #include    <MProEngProfileNameArrayObserver.h>
    30 #include    <MProEngProfileNameArrayObserver.h>
    31 #include    <ProfileEngineConstants.h>
    31 #include    <ProfileEngineConstants.h>
    32 #include    <ProfileEnginePrivatePSKeys.h>
    32 #include    <ProfileEnginePrivatePSKeys.h>
    33 
    33 #include    "CProEngActiveSettingsEventDelegate.h"
       
    34 #include    "CProEngMasterSettingsEventDelegate.h"
    34 
    35 
    35 // ============================= LOCAL FUNCTIONS ===============================
    36 // ============================= LOCAL FUNCTIONS ===============================
    36 
    37 
    37 // -----------------------------------------------------------------------------
    38 // -----------------------------------------------------------------------------
    38 // CompareDelegates
    39 // CompareDelegates
    51 
    52 
    52 // -----------------------------------------------------------------------------
    53 // -----------------------------------------------------------------------------
    53 // CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl
    54 // CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl
    54 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    55 //
    56 //
    56 CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl()
    57 CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl() : 
       
    58     iActiveIdEventDelegate( NULL ),
       
    59     iActiveProfileEventDelegate( NULL ),
       
    60     iNameArrayEventDelegate( NULL ),
       
    61     iActiveSettingEventDelegate( NULL ),
       
    62     iMasterSettingEventDelegate( NULL )
    57     {
    63     {
    58     }
    64     }
    59 
    65 
    60 // -----------------------------------------------------------------------------
    66 // -----------------------------------------------------------------------------
    61 // CProEngNotifyHandlerImpl::NewL
    67 // CProEngNotifyHandlerImpl::NewL
   191         iNameArrayEventDelegate = NULL;
   197         iNameArrayEventDelegate = NULL;
   192         }
   198         }
   193 
   199 
   194     return result;
   200     return result;
   195     }
   201     }
       
   202 
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CProEngNotifyHandlerImpl::RequestActiveSettingsNotificationsL
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 TInt CProEngNotifyHandlerImpl::RequestActiveSettingsNotificationsL( 
       
   209         MProEngActiveSettingsObserver &aObserver )
       
   210     {
       
   211     if( iActiveSettingEventDelegate )
       
   212         {
       
   213         return KErrAlreadyExists;
       
   214         }
       
   215 
       
   216     iActiveSettingEventDelegate = CProEngActiveSettingsEventDelegate::NewL(
       
   217             aObserver );
       
   218             
       
   219     // make the actual request to the Central Repository:
       
   220     TInt result( iActiveSettingEventDelegate->RequestNotification() );
       
   221     if( result != KErrNone )
       
   222         {
       
   223         delete iActiveSettingEventDelegate;
       
   224         iActiveSettingEventDelegate = NULL;
       
   225         }
       
   226 
       
   227     return result;
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CProEngNotifyHandlerImpl::RequestMasterSettingsNotificationsL
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 TInt CProEngNotifyHandlerImpl::RequestMasterSettingsNotificationsL( 
       
   235         MProEngMasterSettingsObserver &aObserver )
       
   236     {
       
   237     if( iMasterSettingEventDelegate )
       
   238         {
       
   239         return KErrAlreadyExists;
       
   240         }
       
   241 
       
   242     iMasterSettingEventDelegate = CProEngMasterSettingsEventDelegate::NewL(
       
   243             aObserver );
       
   244             
       
   245     // make the actual request to the Central Repository:
       
   246     TInt result( iMasterSettingEventDelegate->RequestNotification() );
       
   247     if( result != KErrNone )
       
   248         {
       
   249         delete iMasterSettingEventDelegate;
       
   250         iMasterSettingEventDelegate = NULL;
       
   251         }
       
   252 
       
   253     return result;
       
   254     }
       
   255 
   196 
   256 
   197 // -----------------------------------------------------------------------------
   257 // -----------------------------------------------------------------------------
   198 // CProEngNotifyHandlerImpl::CancelProfileActivationNotifications
   258 // CProEngNotifyHandlerImpl::CancelProfileActivationNotifications
   199 // -----------------------------------------------------------------------------
   259 // -----------------------------------------------------------------------------
   200 //
   260 //
   254         delete iNameArrayEventDelegate;
   314         delete iNameArrayEventDelegate;
   255         iNameArrayEventDelegate = NULL;
   315         iNameArrayEventDelegate = NULL;
   256         }
   316         }
   257     }
   317     }
   258 
   318 
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // CProEngNotifyHandlerImpl::CancelActiveSettingsNotificationsL
       
   322 // -----------------------------------------------------------------------------
       
   323 //
       
   324 void CProEngNotifyHandlerImpl::CancelActiveSettingsNotificationsL()
       
   325     {
       
   326     if( iActiveSettingEventDelegate )
       
   327         {
       
   328         iActiveSettingEventDelegate->Cancel();
       
   329         delete iActiveSettingEventDelegate;
       
   330         iActiveSettingEventDelegate = NULL;
       
   331         }
       
   332     }
       
   333 
       
   334 // -----------------------------------------------------------------------------
       
   335 // CProEngNotifyHandlerImpl::CancelMasterSettingsNotificationsL
       
   336 // -----------------------------------------------------------------------------
       
   337 //
       
   338 void CProEngNotifyHandlerImpl::CancelMasterSettingsNotificationsL()
       
   339     {
       
   340     if( iMasterSettingEventDelegate )
       
   341         {
       
   342         iMasterSettingEventDelegate->Cancel();
       
   343         delete iMasterSettingEventDelegate;
       
   344         iMasterSettingEventDelegate = NULL;
       
   345         }
       
   346     }
       
   347 
   259 // -----------------------------------------------------------------------------
   348 // -----------------------------------------------------------------------------
   260 // CProEngNotifyHandlerImpl::CancelAll
   349 // CProEngNotifyHandlerImpl::CancelAll
   261 // -----------------------------------------------------------------------------
   350 // -----------------------------------------------------------------------------
   262 //
   351 //
   263 void CProEngNotifyHandlerImpl::CancelAll()
   352 void CProEngNotifyHandlerImpl::CancelAll()
   264     {
   353     {
   265     CancelProfileActivationNotifications();
   354     CancelProfileActivationNotifications();
   266     CancelActiveProfileNotifications();
   355     CancelActiveProfileNotifications();
   267     CancelProfileNameArrayNotifications();
   356     CancelProfileNameArrayNotifications();
       
   357     CancelActiveSettingsNotificationsL();
       
   358     CancelMasterSettingsNotificationsL();
       
   359     
   268     TInt count = iProfileEventDelegates.Count();
   360     TInt count = iProfileEventDelegates.Count();
   269     for( TInt i( 0 ); i<count; ++i )
   361     for( TInt i( 0 ); i<count; ++i )
   270         {
   362         {
   271         iProfileEventDelegates[i]->Cancel();
   363         iProfileEventDelegates[i]->Cancel();
   272         }
   364         }