javamanager/javainstaller/iconsizenotifplugin/src/iconsizenotifier.cpp
changeset 61 bf7ee68962da
equal deleted inserted replaced
48:e0d6e9bd3ca7 61:bf7ee68962da
       
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32cmn.h>
       
    19 #include <eikenv.h>
       
    20 #include <bautils.h>
       
    21 #include <ecom/implementationproxy.h>
       
    22 
       
    23 #include "iconsizenotifier.h"
       
    24 #include "iconsizeutils.h"
       
    25 
       
    26 const TUid KUidScreenOutput = { 0x10009D48 };
       
    27 
       
    28 CIconSizeNotifier* CIconSizeNotifier::NewLC()
       
    29 {
       
    30     CIconSizeNotifier* self = new(ELeave) CIconSizeNotifier();
       
    31     CleanupStack::PushL(self);
       
    32     self->ConstructL();
       
    33     return self;
       
    34 }
       
    35 
       
    36 CIconSizeNotifier::~CIconSizeNotifier()
       
    37 {
       
    38 }
       
    39 
       
    40 CIconSizeNotifier::CIconSizeNotifier()
       
    41 {
       
    42 }
       
    43 
       
    44 void CIconSizeNotifier::ConstructL()
       
    45 {
       
    46 }
       
    47 
       
    48 void CIconSizeNotifier::Release()
       
    49 {
       
    50     delete this;
       
    51 }
       
    52 
       
    53 CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::RegisterL()
       
    54 {
       
    55     iInfo.iUid = KUidIconSizeNotifPlugin;
       
    56     iInfo.iChannel = KUidScreenOutput;
       
    57     iInfo.iPriority = ENotifierPriorityHigh;
       
    58     return iInfo;
       
    59 }
       
    60 
       
    61 CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::Info() const
       
    62 {
       
    63     return iInfo;
       
    64 }
       
    65 
       
    66 void CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage)
       
    67 {
       
    68     TPckgBuf<TIconSizes> res(IconSizeUtils::GetIconSizes());
       
    69     aMessage.WriteL(aReplySlot, res);
       
    70     aMessage.Complete(KErrNone);
       
    71 }
       
    72 
       
    73 TPtrC8 CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/)
       
    74 {
       
    75     return KNullDesC8();
       
    76 }
       
    77 
       
    78 void CIconSizeNotifier::Cancel()
       
    79 {
       
    80 }
       
    81 
       
    82 TPtrC8 CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/)
       
    83 {
       
    84     return KNullDesC8();
       
    85 }
       
    86 
       
    87 void CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
       
    88 {
       
    89     aMessage.Complete(KErrNotSupported);
       
    90 }
       
    91 
       
    92 void CreateNotifiersL(CArrayPtrFlat<MEikSrvNotifierBase2>& aNotifiers)
       
    93 {
       
    94     CIconSizeNotifier* notifier1 = CIconSizeNotifier::NewLC();
       
    95     aNotifiers.AppendL(notifier1);
       
    96     CleanupStack::Pop(notifier1);
       
    97 }
       
    98 
       
    99 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
       
   100 {
       
   101     CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
       
   102     if (notifiers)
       
   103     {
       
   104         TRAPD(err, CreateNotifiersL(*notifiers));
       
   105         if (err)
       
   106         {
       
   107             TInt count = notifiers->Count();
       
   108             while (count--)
       
   109             {
       
   110                 (*notifiers)[count]->Release();
       
   111             }
       
   112             delete notifiers;
       
   113             notifiers = NULL;
       
   114         }
       
   115     }
       
   116     return notifiers;
       
   117 }
       
   118 
       
   119 TInt CIconSizeNotifier::NotifierCapabilites()
       
   120 {
       
   121     return ENoSpecialCapabilities;
       
   122 }
       
   123 
       
   124 // ECom plugin entry point
       
   125 const TImplementationProxy ImplementationTable[] =
       
   126 {
       
   127     IMPLEMENTATION_PROXY_ENTRY(0x101FD68A, NotifierArray)
       
   128 };
       
   129 
       
   130 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   131 {
       
   132     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   133     return ImplementationTable;
       
   134 }
       
   135