idlefw/plugins/devicestatus/src/aioperatornamepublisher.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 8 d0529222e3f0
child 15 a0713522ab97
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
    18 
    18 
    19 #include <StringLoader.h>
    19 #include <StringLoader.h>
    20 #include <centralrepository.h>
    20 #include <centralrepository.h>
    21 #include <avkondomainpskeys.h>
    21 #include <avkondomainpskeys.h>
    22 #include <e32property.h>
    22 #include <e32property.h>
       
    23 #include <ProEngFactory.h>
       
    24 #include <MProfileEngine.h>
       
    25 #include <MProfile.h>
       
    26 #include <MProfilename.h>
       
    27 #include <MProEngNotifyHandler.h>
    23 
    28 
    24 #include <aidevstaplgres.rsg>
    29 #include <aidevstaplgres.rsg>
    25 #include "aioperatornamepublisher.h"
    30 #include "aioperatornamepublisher.h"
    26 #include "ainetworkinfolistener.h"
    31 #include "ainetworkinfolistener.h"
    27 #include "aidevicestatuscontentmodel.h"
    32 #include "aidevicestatuscontentmodel.h"
    34 
    39 
    35 
    40 
    36 const TInt KBitShiftByFour = 4;
    41 const TInt KBitShiftByFour = 4;
    37 const TInt KIsDigitLowLimit = 0;
    42 const TInt KIsDigitLowLimit = 0;
    38 const TInt KIsDigitHighLimit = 10;
    43 const TInt KIsDigitHighLimit = 10;
       
    44 const TInt KOfflineProfileId =  5;
    39 
    45 
    40 LOCAL_C void AppendDigit( TDes& aCode, TInt aValue )
    46 LOCAL_C void AppendDigit( TDes& aCode, TInt aValue )
    41     {
    47     {
    42     // add a digit if valid value.
    48     // add a digit if valid value.
    43     if ( aValue >= KIsDigitLowLimit && aValue < KIsDigitHighLimit )
    49     if ( aValue >= KIsDigitLowLimit && aValue < KIsDigitHighLimit )
    73 
    79 
    74 void CAiOperatorNamePublisher::ConstructL()
    80 void CAiOperatorNamePublisher::ConstructL()
    75     {
    81     {
    76     iListener = CAiNetworkInfoListener::InstanceL();
    82     iListener = CAiNetworkInfoListener::InstanceL();
    77     iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
    83     iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
       
    84     iProfileEngine = CreateProfileEngineL();
       
    85     iProfileNotifier = ProEngFactory::NewNotifyHandlerL();
       
    86     iProfileNotifier->RequestProfileActivationNotificationsL( *this );
    78     }
    87     }
    79 
    88 
    80 
    89 
    81 CAiOperatorNamePublisher* CAiOperatorNamePublisher::NewL()
    90 CAiOperatorNamePublisher* CAiOperatorNamePublisher::NewL()
    82     {
    91     {
    98     if( iPeriodic )
   107     if( iPeriodic )
    99         {
   108         {
   100         iPeriodic->Cancel();
   109         iPeriodic->Cancel();
   101         delete iPeriodic;
   110         delete iPeriodic;
   102         }
   111         }
       
   112     if ( iProfileNotifier )
       
   113         {
       
   114         iProfileNotifier->CancelAll();
       
   115         delete iProfileNotifier;
       
   116         }
       
   117     if( iProfileEngine )
       
   118         {
       
   119         iProfileEngine->Release();
       
   120         }
   103     }
   121     }
   104 
   122 
   105 
   123 
   106 void CAiOperatorNamePublisher::ResumeL()
   124 void CAiOperatorNamePublisher::ResumeL()
   107     {
   125     {
   123         {
   141         {
   124         TRAP_IGNORE  ( RefreshL( ETrue ));
   142         TRAP_IGNORE  ( RefreshL( ETrue ));
   125         }
   143         }
   126     else
   144     else
   127         {
   145         {
   128         TRAP_IGNORE (
   146         if ( iProfileEngine->ActiveProfileId() != KOfflineProfileId )
   129             iPrioritizer->TryToCleanL( *iBroadcaster,
   147             {
   130                                     EAiDeviceStatusContentNetworkIdentity,
   148             TRAP_IGNORE (
   131                                     iPriority ));
   149                 iPrioritizer->TryToCleanL( *iBroadcaster,
       
   150                                         EAiDeviceStatusContentNetworkIdentity,
       
   151                                         iPriority ));
       
   152             }
   132         }    
   153         }    
   133     }
   154     }
   134 
   155 
   135 
   156 
   136 void CAiOperatorNamePublisher::Subscribe( MAiContentObserver& /*aObserver*/,
   157 void CAiOperatorNamePublisher::Subscribe( MAiContentObserver& /*aObserver*/,
   148     {
   169     {
   149     iSuccess = EFalse;
   170     iSuccess = EFalse;
   150 
   171 
   151     if ( iSuspended )
   172     if ( iSuspended )
   152         {
   173         {
       
   174         return;
       
   175         }
       
   176     
       
   177     if ( iProfileEngine->ActiveProfileId() == KOfflineProfileId )
       
   178         {
       
   179         MProfile* profile = iProfileEngine->ActiveProfileLC();
       
   180         const MProfileName& name = profile->ProfileName();
       
   181         iPrioritizer->TryToPublishL( *iBroadcaster,
       
   182                                       EAiDeviceStatusContentNetworkIdentity,
       
   183                                       name.Name(),
       
   184                                       iPriority );
       
   185         iSuccess = ETrue;
       
   186         CleanupStack::PopAndDestroy();//profile
   153         return;
   187         return;
   154         }
   188         }
   155     
   189     
   156     if( aClean )
   190     if( aClean )
   157         {
   191         {
   730         default:
   764         default:
   731         	return EFalse;
   765         	return EFalse;
   732        	}
   766        	}
   733   	}
   767   	}
   734 
   768 
       
   769 void CAiOperatorNamePublisher::HandleProfileActivatedL( TInt /*aProfileId*/ )
       
   770     {
       
   771     RefreshL( EFalse );
       
   772     }
       
   773