idlehomescreen/nativeuicontroller/src/ainotifierrenderer.cpp
branchRCL_3
changeset 9 f966699dea19
parent 0 f72a12da539e
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
    13 *
    13 *
    14 * Description:  Dialog renderer.
    14 * Description:  Dialog renderer.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 // System includes 
       
    19 #include <e32property.h>
    18 
    20 
    19 #include <e32property.h>
    21 // User includes
       
    22 #include <hscontentpublisher.h>
       
    23 #include <hspublisherinfo.h>
    20 #include <activeidle2domainpskeys.h>
    24 #include <activeidle2domainpskeys.h>
    21 #include <aipropertyextension.h>
       
    22 
       
    23 #include <AiNativeUi.rsg>
    25 #include <AiNativeUi.rsg>
    24 
       
    25 #include "ainotifierrenderer.h"
    26 #include "ainotifierrenderer.h"
    26 #include "ainativeuiplugins.h"
    27 #include "ainativeuiplugins.h"
    27 
    28 
    28 using namespace AiNativeUiController;
    29 using namespace AiNativeUiController;
       
    30 
       
    31 // Constants
    29 
    32 
    30 // 1-minute timeout before showing soft notification
    33 // 1-minute timeout before showing soft notification
    31 const TInt KNetworkLostTimeout = 60*1000000;
    34 const TInt KNetworkLostTimeout = 60*1000000;
    32 
    35 
    33 // ======== MEMBER FUNCTIONS ========
    36 // ======== MEMBER FUNCTIONS ========
    34 
    37 
       
    38 // ----------------------------------------------------------------------------
       
    39 // CAiNotifierRenderer::NewLC()
       
    40 //
       
    41 // ----------------------------------------------------------------------------
       
    42 //
    35 CAiNotifierRenderer* CAiNotifierRenderer::NewLC()
    43 CAiNotifierRenderer* CAiNotifierRenderer::NewLC()
    36     {
    44     {
    37     CAiNotifierRenderer* self = new( ELeave ) CAiNotifierRenderer;
    45     CAiNotifierRenderer* self = new( ELeave ) CAiNotifierRenderer;
    38     CleanupStack::PushL( self );
    46     CleanupStack::PushL( self );
    39     self->ConstructL();
    47     self->ConstructL();
    40     return self;
    48     return self;
    41     }
    49     }
    42 
    50 
    43 
    51 // ----------------------------------------------------------------------------
       
    52 // CAiNotifierRenderer::~CAiNotifierRenderer()
       
    53 //
       
    54 // ----------------------------------------------------------------------------
       
    55 //
    44 CAiNotifierRenderer::~CAiNotifierRenderer()
    56 CAiNotifierRenderer::~CAiNotifierRenderer()
    45     {
    57     {
    46     delete iSoftNotifier;
    58     delete iSoftNotifier;
    47     delete iTimer;
    59     delete iTimer;
    48     }
    60     }
    49 
    61 
    50 
    62 // ----------------------------------------------------------------------------
       
    63 // CAiNotifierRenderer::CAiNotifierRenderer()
       
    64 //
       
    65 // ----------------------------------------------------------------------------
       
    66 //
    51 CAiNotifierRenderer::CAiNotifierRenderer()
    67 CAiNotifierRenderer::CAiNotifierRenderer()
    52     {
    68     {
    53     }
    69     }
    54 
    70 
       
    71 // ----------------------------------------------------------------------------
       
    72 // CAiNotifierRenderer::ConstructL()
       
    73 //
       
    74 // ----------------------------------------------------------------------------
       
    75 //
    55 void CAiNotifierRenderer::ConstructL()
    76 void CAiNotifierRenderer::ConstructL()
    56     {
    77     {
    57     iSoftNotifier = CAknSoftNotifier::NewL();
    78     iSoftNotifier = CAknSoftNotifier::NewL();
    58     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
    79     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
    59     }
    80     }
    60 
    81 
    61 void CAiNotifierRenderer::DoPublishL( MAiPropertyExtension& aPlugin,
    82 // ----------------------------------------------------------------------------
    62                                     TInt aContent,
    83 // CAiNotifierRenderer::DoPublishL()
    63                                     TInt aResource,
    84 //
    64                                     TInt /*aIndex*/  )
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 void CAiNotifierRenderer::DoPublishL( CHsContentPublisher& aPlugin,
       
    88     TInt aContent, TInt aResource, TInt /*aIndex*/ )                                                                       
    65     {
    89     {
    66     if( aPlugin.PublisherInfoL()->iUid == KDeviceStatusPluginUid )
    90     const THsPublisherInfo& info( aPlugin.PublisherInfo() );
       
    91     
       
    92     if( info.Uid() == KDeviceStatusPluginUid )
    67     	{
    93     	{
    68 	    switch( aContent )
    94 	    switch( aContent )
    69 	        {
    95 	        {
    70 	        case EAiDeviceStatusContentNWStatus:
    96 	        case EAiDeviceStatusContentNWStatus:
    71 	            {
    97 	            {
    88 	        default:
   114 	        default:
    89 	            {
   115 	            {
    90 	            User::Leave( KErrNotFound );
   116 	            User::Leave( KErrNotFound );
    91 	            break;
   117 	            break;
    92 	            }
   118 	            }
    93 	        };
   119 	        }
    94     	}
   120     	}
    95     else
   121     else
    96    		{
   122    		{
    97    		User::Leave( KErrNotFound );
   123    		User::Leave( KErrNotFound );
    98    		}
   124    		}
    99     }
   125     }
   100 
   126 
   101 void CAiNotifierRenderer::DoCleanL( MAiPropertyExtension& /*aPlugin*/,
   127 // ----------------------------------------------------------------------------
   102                                     TInt aContent )
   128 // CAiNotifierRenderer::DoCleanL()
       
   129 //
       
   130 // ----------------------------------------------------------------------------
       
   131 //
       
   132 void CAiNotifierRenderer::DoCleanL( CHsContentPublisher& /*aPlugin*/,
       
   133     TInt aContent )
   103     {
   134     {
   104     switch( aContent )
   135     switch( aContent )
   105         {
   136         {
   106         case EAiDeviceStatusContentNWStatus:
   137         case EAiDeviceStatusContentNWStatus:
   107             {
   138             {
   112         default:
   143         default:
   113             {
   144             {
   114             User::Leave( KErrNotFound );
   145             User::Leave( KErrNotFound );
   115             break;
   146             break;
   116             }
   147             }
   117         };
   148         }
   118 
       
   119     }
   149     }
   120 
   150 
   121 
   151 // ----------------------------------------------------------------------------
       
   152 // CAiNotifierRenderer::AddNotification()
       
   153 //
       
   154 // ----------------------------------------------------------------------------
       
   155 //
   122 void CAiNotifierRenderer::AddNotification( TAknSoftNotificationType aType )
   156 void CAiNotifierRenderer::AddNotification( TAknSoftNotificationType aType )
   123     {
   157     {
   124     TRAP_IGNORE( iSoftNotifier->AddNotificationL( aType, 1 ); );
   158     TRAP_IGNORE( iSoftNotifier->AddNotificationL( aType, 1 ) );
   125     }
   159     }
   126 
   160 
   127 void CAiNotifierRenderer::RemoveNotification( TAknSoftNotificationType aType)
   161 // ----------------------------------------------------------------------------
       
   162 // CAiNotifierRenderer::RemoveNotification()
       
   163 //
       
   164 // ----------------------------------------------------------------------------
       
   165 //
       
   166 void CAiNotifierRenderer::RemoveNotification( TAknSoftNotificationType aType )
   128     {
   167     {
   129     TRAP_IGNORE( iSoftNotifier->CancelSoftNotificationL( aType ); );
   168     TRAP_IGNORE( iSoftNotifier->CancelSoftNotificationL( aType ); );
   130     }
   169     }
   131 
   170 
   132 TInt CAiNotifierRenderer::NWLostDelayCallBack(TAny* aParam)
   171 // ----------------------------------------------------------------------------
       
   172 // CAiNotifierRenderer::NWLostDelayCallBack()
       
   173 //
       
   174 // ----------------------------------------------------------------------------
       
   175 //
       
   176 TInt CAiNotifierRenderer::NWLostDelayCallBack( TAny* aParam )
   133     {
   177     {
   134     CAiNotifierRenderer* self = reinterpret_cast<CAiNotifierRenderer *> (aParam);
   178     CAiNotifierRenderer* self = 
   135     if ( self )
   179         reinterpret_cast< CAiNotifierRenderer* >( aParam );
       
   180     
       
   181         if ( self )
   136         {
   182         {
   137         self->iTimer->Cancel();
   183         self->iTimer->Cancel();
   138         self->AddNotification( ESelectNetworkNotification );
   184         self->AddNotification( ESelectNetworkNotification );
   139         }
   185         }
       
   186         
   140     return KErrNone;
   187     return KErrNone;
   141     }
   188     }
   142 
   189 
       
   190 // End of file
   143 
   191