profilesservices/ProfileEngine/WrapperSrc/CProEngNotifyHandlerImpl.cpp
branchGCC_SURGE
changeset 45 f48d04161a92
parent 29 56ba5cd39aab
child 68 13e71d907dc3
equal deleted inserted replaced
27:572294aa6075 45:f48d04161a92
    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 #include    "CProEngActiveSettingsEventDelegate.h"
    33 
    34 #include    "CProEngMasterSettingsEventDelegate.h"
       
    35 
    34 
    36 // ============================= LOCAL FUNCTIONS ===============================
    35 // ============================= LOCAL FUNCTIONS ===============================
    37 
    36 
    38 // -----------------------------------------------------------------------------
    37 // -----------------------------------------------------------------------------
    39 // CompareDelegates
    38 // CompareDelegates
    55 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    56 //
    55 //
    57 CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl() : 
    56 CProEngNotifyHandlerImpl::CProEngNotifyHandlerImpl() : 
    58     iActiveIdEventDelegate( NULL ),
    57     iActiveIdEventDelegate( NULL ),
    59     iActiveProfileEventDelegate( NULL ),
    58     iActiveProfileEventDelegate( NULL ),
    60     iNameArrayEventDelegate( NULL ),
    59     iNameArrayEventDelegate( NULL )
    61     iActiveSettingEventDelegate( NULL ),
       
    62     iMasterSettingEventDelegate( NULL )
       
    63     {
    60     {
    64     }
    61     }
    65 
    62 
    66 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    67 // CProEngNotifyHandlerImpl::NewL
    64 // CProEngNotifyHandlerImpl::NewL
   197         iNameArrayEventDelegate = NULL;
   194         iNameArrayEventDelegate = NULL;
   198         }
   195         }
   199 
   196 
   200     return result;
   197     return result;
   201     }
   198     }
   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 
       
   256 
   199 
   257 // -----------------------------------------------------------------------------
   200 // -----------------------------------------------------------------------------
   258 // CProEngNotifyHandlerImpl::CancelProfileActivationNotifications
   201 // CProEngNotifyHandlerImpl::CancelProfileActivationNotifications
   259 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   260 //
   203 //
   314         delete iNameArrayEventDelegate;
   257         delete iNameArrayEventDelegate;
   315         iNameArrayEventDelegate = NULL;
   258         iNameArrayEventDelegate = NULL;
   316         }
   259         }
   317     }
   260     }
   318 
   261 
   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 
       
   348 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   349 // CProEngNotifyHandlerImpl::CancelAll
   263 // CProEngNotifyHandlerImpl::CancelAll
   350 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   351 //
   265 //
   352 void CProEngNotifyHandlerImpl::CancelAll()
   266 void CProEngNotifyHandlerImpl::CancelAll()
   353     {
   267     {
   354     CancelProfileActivationNotifications();
   268     CancelProfileActivationNotifications();
   355     CancelActiveProfileNotifications();
   269     CancelActiveProfileNotifications();
   356     CancelProfileNameArrayNotifications();
   270     CancelProfileNameArrayNotifications();
   357     CancelActiveSettingsNotificationsL();
       
   358     CancelMasterSettingsNotificationsL();
       
   359     
       
   360     TInt count = iProfileEventDelegates.Count();
   271     TInt count = iProfileEventDelegates.Count();
   361     for( TInt i( 0 ); i<count; ++i )
   272     for( TInt i( 0 ); i<count; ++i )
   362         {
   273         {
   363         iProfileEventDelegates[i]->Cancel();
   274         iProfileEventDelegates[i]->Cancel();
   364         }
   275         }