pkiutilities/securitydialognotifier/src/securitydialognotifier.cpp
author hgs
Fri, 20 Aug 2010 11:27:50 +0300
changeset 48 6ed68423b759
permissions -rw-r--r--
201033_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48
6ed68423b759 201033_01
hgs
parents:
diff changeset
     1
/*
6ed68423b759 201033_01
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6ed68423b759 201033_01
hgs
parents:
diff changeset
     3
* All rights reserved.
6ed68423b759 201033_01
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6ed68423b759 201033_01
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
6ed68423b759 201033_01
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6ed68423b759 201033_01
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6ed68423b759 201033_01
hgs
parents:
diff changeset
     8
*
6ed68423b759 201033_01
hgs
parents:
diff changeset
     9
* Initial Contributors:
6ed68423b759 201033_01
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6ed68423b759 201033_01
hgs
parents:
diff changeset
    11
*
6ed68423b759 201033_01
hgs
parents:
diff changeset
    12
* Contributors:
6ed68423b759 201033_01
hgs
parents:
diff changeset
    13
*
6ed68423b759 201033_01
hgs
parents:
diff changeset
    14
* Description:  Security dialog notifier
6ed68423b759 201033_01
hgs
parents:
diff changeset
    15
*
6ed68423b759 201033_01
hgs
parents:
diff changeset
    16
*/
6ed68423b759 201033_01
hgs
parents:
diff changeset
    17
6ed68423b759 201033_01
hgs
parents:
diff changeset
    18
#include "securitydialognotifier.h"     // CSecurityDialogNotifier
6ed68423b759 201033_01
hgs
parents:
diff changeset
    19
#include "securitydialogs.h"            // CSecurityDialogs
6ed68423b759 201033_01
hgs
parents:
diff changeset
    20
#include "securitydialogstrace.h"       // TRACE macro
6ed68423b759 201033_01
hgs
parents:
diff changeset
    21
6ed68423b759 201033_01
hgs
parents:
diff changeset
    22
6ed68423b759 201033_01
hgs
parents:
diff changeset
    23
// ======== MEMBER FUNCTIONS ========
6ed68423b759 201033_01
hgs
parents:
diff changeset
    24
6ed68423b759 201033_01
hgs
parents:
diff changeset
    25
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    26
// CSecurityDialogNotifier::~CSecurityDialogNotifier()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    27
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    28
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    29
CSecurityDialogNotifier::~CSecurityDialogNotifier()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    30
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    31
    TRACE( "CSecurityDialogNotifier::~CSecurityDialogNotifier" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    32
    Cancel();
6ed68423b759 201033_01
hgs
parents:
diff changeset
    33
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    34
6ed68423b759 201033_01
hgs
parents:
diff changeset
    35
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    36
// CSecurityDialogNotifier::NewL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    37
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    38
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    39
CSecurityDialogNotifier* CSecurityDialogNotifier::NewL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    40
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    41
    CSecurityDialogNotifier* self = new( ELeave ) CSecurityDialogNotifier;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    42
    CleanupStack::PushL( self );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    43
    self->ConstructL();
6ed68423b759 201033_01
hgs
parents:
diff changeset
    44
    CleanupStack::Pop( self );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    45
    return self;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    46
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    47
6ed68423b759 201033_01
hgs
parents:
diff changeset
    48
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    49
// CSecurityDialogNotifier::Release()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    50
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    51
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    52
void CSecurityDialogNotifier::Release()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    53
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    54
    TRACE( "CSecurityDialogNotifier::Release" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    55
    delete this;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    56
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    57
6ed68423b759 201033_01
hgs
parents:
diff changeset
    58
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    59
// CSecurityDialogNotifier::RegisterL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    60
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    61
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    62
CSecurityDialogNotifier::TNotifierInfo CSecurityDialogNotifier::RegisterL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    63
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    64
    return Info();
6ed68423b759 201033_01
hgs
parents:
diff changeset
    65
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    66
6ed68423b759 201033_01
hgs
parents:
diff changeset
    67
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    68
// CSecurityDialogNotifier::Info()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    69
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    70
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    71
CSecurityDialogNotifier::TNotifierInfo CSecurityDialogNotifier::Info() const
6ed68423b759 201033_01
hgs
parents:
diff changeset
    72
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    73
    TNotifierInfo info;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    74
    info.iUid = KUidSecurityDialogNotifier;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    75
    info.iChannel = KUidSecurityDialogNotifier;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    76
    info.iPriority = ENotifierPriorityAbsolute;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    77
    return info;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    78
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    79
6ed68423b759 201033_01
hgs
parents:
diff changeset
    80
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    81
// CSecurityDialogNotifier::StartL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
    82
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
    83
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
    84
void CSecurityDialogNotifier::StartL( const TDesC8& aBuffer, TInt aReplySlot,
6ed68423b759 201033_01
hgs
parents:
diff changeset
    85
        const RMessagePtr2& aMessage )
6ed68423b759 201033_01
hgs
parents:
diff changeset
    86
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    87
    TRACE( "CSecurityDialogNotifier::StartL, begin" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    88
6ed68423b759 201033_01
hgs
parents:
diff changeset
    89
    TRAPD( err, DoStartL( aBuffer, aReplySlot, aMessage ) );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    90
    TRACE( "CSecurityDialogNotifier::StartL, DoStartL err=%d", err );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    91
    if( err )
6ed68423b759 201033_01
hgs
parents:
diff changeset
    92
        {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    93
        if( iSecurityDialogs && !iIsSecurityDialogsDeleted )
6ed68423b759 201033_01
hgs
parents:
diff changeset
    94
            {
6ed68423b759 201033_01
hgs
parents:
diff changeset
    95
            TRACE( "CSecurityDialogNotifier::StartL, deleting iSecurityDialogs" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
    96
            delete iSecurityDialogs;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    97
            iSecurityDialogs = NULL;
6ed68423b759 201033_01
hgs
parents:
diff changeset
    98
            }
6ed68423b759 201033_01
hgs
parents:
diff changeset
    99
        if( !aMessage.IsNull() )
6ed68423b759 201033_01
hgs
parents:
diff changeset
   100
            {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   101
            TRACE( "CSecurityDialogNotifier::StartL, completing message" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   102
            aMessage.Complete( err );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   103
            }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   104
        }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   105
6ed68423b759 201033_01
hgs
parents:
diff changeset
   106
    TRACE( "CSecurityDialogNotifier::StartL, end" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   107
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   108
6ed68423b759 201033_01
hgs
parents:
diff changeset
   109
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   110
// CSecurityDialogNotifier::StartL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   111
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   112
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   113
TPtrC8 CSecurityDialogNotifier::StartL( const TDesC8& /*aBuffer*/ )
6ed68423b759 201033_01
hgs
parents:
diff changeset
   114
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   115
    return KNullDesC8();
6ed68423b759 201033_01
hgs
parents:
diff changeset
   116
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   117
6ed68423b759 201033_01
hgs
parents:
diff changeset
   118
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   119
// CSecurityDialogNotifier::Cancel()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   120
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   121
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   122
void CSecurityDialogNotifier::Cancel()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   123
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   124
    TRACE( "CSecurityDialogNotifier::Cancel" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   125
    if( iSecurityDialogs && !iIsSecurityDialogsDeleted )
6ed68423b759 201033_01
hgs
parents:
diff changeset
   126
        {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   127
        TRACE( "CSecurityDialogNotifier::Cancel, deleting iSecurityDialogs" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   128
        delete iSecurityDialogs;
6ed68423b759 201033_01
hgs
parents:
diff changeset
   129
        iSecurityDialogs = NULL;
6ed68423b759 201033_01
hgs
parents:
diff changeset
   130
        }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   131
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   132
6ed68423b759 201033_01
hgs
parents:
diff changeset
   133
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   134
// CSecurityDialogNotifier::UpdateL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   135
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   136
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   137
TPtrC8 CSecurityDialogNotifier::UpdateL( const TDesC8& /*aBuffer*/ )
6ed68423b759 201033_01
hgs
parents:
diff changeset
   138
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   139
    return KNullDesC8();
6ed68423b759 201033_01
hgs
parents:
diff changeset
   140
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   141
6ed68423b759 201033_01
hgs
parents:
diff changeset
   142
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   143
// CSecurityDialogNotifier::CSecurityDialogNotifier()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   144
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   145
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   146
CSecurityDialogNotifier::CSecurityDialogNotifier()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   147
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   148
    TRACE( "CSecurityDialogNotifier::CSecurityDialogNotifier" );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   149
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   150
6ed68423b759 201033_01
hgs
parents:
diff changeset
   151
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   152
// CSecurityDialogNotifier::ConstructL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   153
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   154
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   155
void CSecurityDialogNotifier::ConstructL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   156
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   157
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   158
6ed68423b759 201033_01
hgs
parents:
diff changeset
   159
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   160
// CSecurityDialogNotifier::DoStartL()
6ed68423b759 201033_01
hgs
parents:
diff changeset
   161
// ---------------------------------------------------------------------------
6ed68423b759 201033_01
hgs
parents:
diff changeset
   162
//
6ed68423b759 201033_01
hgs
parents:
diff changeset
   163
void CSecurityDialogNotifier::DoStartL( const TDesC8& aBuffer, TInt aReplySlot,
6ed68423b759 201033_01
hgs
parents:
diff changeset
   164
        const RMessagePtr2& aMessage )
6ed68423b759 201033_01
hgs
parents:
diff changeset
   165
    {
6ed68423b759 201033_01
hgs
parents:
diff changeset
   166
    iSecurityDialogs = CSecurityDialogs::NewL( iIsSecurityDialogsDeleted );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   167
    iSecurityDialogs->StartLD( aBuffer, aReplySlot, aMessage );
6ed68423b759 201033_01
hgs
parents:
diff changeset
   168
    }
6ed68423b759 201033_01
hgs
parents:
diff changeset
   169