javamanager/javainstaller/iconsizenotifplugin/src/iconsizenotifier.cpp
author hgs
Fri, 09 Jul 2010 16:35:45 +0300
changeset 50 023eef975703
permissions -rw-r--r--
v2.2.4_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     1
/*
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     3
* All rights reserved.
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     8
*
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
     9
* Initial Contributors:
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    11
*
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    12
* Contributors:
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    13
*
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    14
* Description:
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    15
*
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    16
*/
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    17
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    18
#include <e32cmn.h>
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    19
#include <eikenv.h>
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    20
#include <bautils.h>
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    21
#include <ecom/implementationproxy.h>
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    22
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    23
#include "iconsizenotifier.h"
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    24
#include "iconsizeutils.h"
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    25
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    26
const TUid KUidScreenOutput = { 0x10009D48 };
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    27
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    28
CIconSizeNotifier* CIconSizeNotifier::NewLC()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    29
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    30
    CIconSizeNotifier* self = new(ELeave) CIconSizeNotifier();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    31
    CleanupStack::PushL(self);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    32
    self->ConstructL();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    33
    return self;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    34
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    35
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    36
CIconSizeNotifier::~CIconSizeNotifier()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    37
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    38
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    39
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    40
CIconSizeNotifier::CIconSizeNotifier()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    41
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    42
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    43
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    44
void CIconSizeNotifier::ConstructL()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    45
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    46
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    47
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    48
void CIconSizeNotifier::Release()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    49
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    50
    delete this;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    51
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    52
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    53
CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::RegisterL()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    54
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    55
    iInfo.iUid = KUidIconSizeNotifPlugin;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    56
    iInfo.iChannel = KUidScreenOutput;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    57
    iInfo.iPriority = ENotifierPriorityHigh;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    58
    return iInfo;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    59
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    60
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    61
CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::Info() const
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    62
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    63
    return iInfo;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    64
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    65
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    66
void CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    67
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    68
    TPckgBuf<TIconSizes> res(IconSizeUtils::GetIconSizes());
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    69
    aMessage.WriteL(aReplySlot, res);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    70
    aMessage.Complete(KErrNone);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    71
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    72
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    73
TPtrC8 CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    74
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    75
    return KNullDesC8();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    76
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    77
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    78
void CIconSizeNotifier::Cancel()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    79
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    80
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    81
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    82
TPtrC8 CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    83
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    84
    return KNullDesC8();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    85
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    86
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    87
void CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    88
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    89
    aMessage.Complete(KErrNotSupported);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    90
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    91
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    92
void CreateNotifiersL(CArrayPtrFlat<MEikSrvNotifierBase2>& aNotifiers)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    93
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    94
    CIconSizeNotifier* notifier1 = CIconSizeNotifier::NewLC();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    95
    aNotifiers.AppendL(notifier1);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    96
    CleanupStack::Pop(notifier1);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    97
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    98
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
    99
CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   100
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   101
    CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   102
    if (notifiers)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   103
    {
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   104
        TRAPD(err, CreateNotifiersL(*notifiers));
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   105
        if (err)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   106
        {
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   107
            TInt count = notifiers->Count();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   108
            while (count--)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   109
            {
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   110
                (*notifiers)[count]->Release();
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   111
            }
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   112
            delete notifiers;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   113
            notifiers = NULL;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   114
        }
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   115
    }
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   116
    return notifiers;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   117
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   118
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   119
TInt CIconSizeNotifier::NotifierCapabilites()
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   120
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   121
    return ENoSpecialCapabilities;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   122
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   123
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   124
// ECom plugin entry point
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   125
const TImplementationProxy ImplementationTable[] =
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   126
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   127
    IMPLEMENTATION_PROXY_ENTRY(0x101FD68A, NotifierArray)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   128
};
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   129
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   130
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   131
{
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   132
    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   133
    return ImplementationTable;
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   134
}
023eef975703 v2.2.4_1
hgs
parents:
diff changeset
   135