messagingappbase/msgavkon/msgnotifiers/src/MsgNotifiersWrapper.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Methods for MsgNotifiers Ecom Plugins entry point
       
    15 *                 This is a proxy to use MsgNotifiers.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <implementationproxy.h>
       
    24 #include <eiknotapi.h>
       
    25 #include <AknNotifierWrapper.h>
       
    26 
       
    27 #include "MsgNotifiersConst.h"
       
    28 
       
    29 _LIT( KMsgNotifiersDll, "MsgNotifiers.dll" ); 
       
    30 
       
    31 
       
    32 // ----------------------------------------------------------------------------
       
    33 // DoCreateNotifierArrayL
       
    34 // ----------------------------------------------------------------------------
       
    35 
       
    36 void DoCreateNotifierArrayL( 
       
    37     CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
       
    38     {
       
    39     CAknCommonNotifierWrapper* master = 
       
    40             CAknCommonNotifierWrapper::NewL( KSendAsNotifierPluginUid,
       
    41                                              KSendAsNotifierPluginUid,
       
    42                                              MEikSrvNotifierBase2::ENotifierPriorityHigh,
       
    43                                              KMsgNotifiersDll,
       
    44                                              1 ); // no synchronous reply used.
       
    45     CleanupStack::PushL( master );    
       
    46     aNotifiers->AppendL( master ); 
       
    47     CleanupStack::Pop( master );
       
    48     
       
    49     CAknNotifierWrapperLight* light = new ( ELeave ) CAknNotifierWrapperLight(
       
    50                                              *master,
       
    51                                              KSendUiNotifierPluginUid,
       
    52                                              KSendUiNotifierPluginUid,
       
    53                                              MEikSrvNotifierBase2::ENotifierPriorityHigh );
       
    54     
       
    55     CleanupStack::PushL( light );    
       
    56     aNotifiers->AppendL( light ); 
       
    57     CleanupStack::Pop( light );
       
    58     }
       
    59 
       
    60 // ----------------------------------------------------------------------------
       
    61 // NotifierArray()
       
    62 // ----------------------------------------------------------------------------
       
    63 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
    64     {
       
    65     CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL;
       
    66 
       
    67     TRAPD( err, notifiers = new (ELeave) CArrayPtrFlat<MEikSrvNotifierBase2>( 2 ) );
       
    68 
       
    69     if ( err == KErrNone )
       
    70         {
       
    71         if ( notifiers )
       
    72             {
       
    73             TRAPD( err, DoCreateNotifierArrayL( notifiers ));
       
    74             if( err )
       
    75                 {
       
    76                 TInt count = notifiers->Count();
       
    77                 while(count--)
       
    78                     {
       
    79                     (*notifiers)[count]->Release();
       
    80                     }
       
    81                 delete notifiers;
       
    82                 notifiers = NULL;
       
    83                 }
       
    84             }
       
    85         }
       
    86     return notifiers;
       
    87     }
       
    88 
       
    89 
       
    90 // ----------------------------------------------------------------------------
       
    91 // ECOM 
       
    92 // ----------------------------------------------------------------------------
       
    93 
       
    94 const TImplementationProxy ImplementationTable[] =
       
    95     {
       
    96 #ifdef __EABI__
       
    97     {{0x1028289B},(TFuncPtr)NotifierArray},
       
    98 #else
       
    99     {{0x1028289B},NotifierArray},
       
   100 #endif
       
   101     };
       
   102 
       
   103 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
       
   104     TInt& aTableCount )
       
   105     {
       
   106     aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
       
   107     return ImplementationTable;
       
   108     }
       
   109     
       
   110 //  End of File