contentstorage/srvsrc/cainstallnotifier.cpp
author hgs
Tue, 23 Mar 2010 23:42:03 +0200
changeset 87 9d806967057c
parent 85 7feec50967db
child 66 32469d7d46ff
permissions -rw-r--r--
201007
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
 * Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
 * Description:  ?Description
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#include "cainstallnotifier.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
EXPORT_C CCaInstallNotifier* CCaInstallNotifier::NewL(
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
        MCaInstallListener& aListener, TNotificationType aNotificationType )
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
    CCaInstallNotifier* self = new ( ELeave ) CCaInstallNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
            aListener, aNotificationType );
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
    CleanupStack::PushL( self );
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
    self->ConstructL();
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
    CleanupStack::Pop( self );
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
    return self;
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
CCaInstallNotifier::~CCaInstallNotifier()
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
    Cancel();
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
    iProperty.Close();
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
CCaInstallNotifier::CCaInstallNotifier( MCaInstallListener& aListener,
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
        TNotificationType aNotificationType ) :
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
    CActive( EPriorityNormal ), iListener( aListener )
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
    iRPropertyKey = aNotificationType;
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    iProperty.Attach( KUidSystemCategory, iRPropertyKey );
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
    CActiveScheduler::Add( this );
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    iProperty.Subscribe( iStatus );
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
    SetActive();
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
void CCaInstallNotifier::ConstructL()
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
void CCaInstallNotifier::DoCancel()
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    iProperty.Cancel();
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
void CCaInstallNotifier::RunL()
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
    SetActive();
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    iProperty.Subscribe( iStatus );
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    TInt appUid;
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
    User::LeaveIfError( iProperty.Get( KUidSystemCategory, iRPropertyKey,
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
            appUid ) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
    if( appUid )
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
        iListener.HandleInstallNotifyL( appUid );
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
TInt CCaInstallNotifier::RunError( TInt /*aError*/)
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
    // No need to do anything
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
    return KErrNone;
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    }