pkiutilities/CTSecurityDialogs/ClientSrc/CDigSigningNote.cpp
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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:   Implementation of the CDigSigningNote class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CDigSigningNote.h"
       
    21 #include "CTSecurityDialogRequestor.h"
       
    22 #include "CTSecurityDialogDefs.h"
       
    23 #include <s32mem.h>
       
    24 
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES  
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // LOCAL CONSTANTS AND MACROS
       
    35 
       
    36 // MODULE DATA STRUCTURES
       
    37 
       
    38 // LOCAL FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 
       
    42 
       
    43 // ============================ MEMBER FUNCTIONS ===============================
       
    44 
       
    45 EXPORT_C MDigSigningNote* DigSigningNoteFactory::CreateNoteL()
       
    46     {
       
    47     return CDigSigningNote::NewL();
       
    48     }
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CDigSigningNote::CDigSigningNote
       
    54 // C++ default constructor can NOT contain any code, that
       
    55 // might leave.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CDigSigningNote::CDigSigningNote(): CSecurityDialogBase()
       
    59     {
       
    60     }
       
    61 // -----------------------------------------------------------------------------
       
    62 // CDigSigningNote::ConstructL
       
    63 // Symbian 2nd phase constructor can leave.
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CDigSigningNote::ConstructL()
       
    67     {
       
    68     iSenderBuffer = CBufFlat::NewL( KCTSecDialSendBufLen );
       
    69     CSecurityDialogBase::ConstructL();
       
    70     }
       
    71 // -----------------------------------------------------------------------------
       
    72 // CDigSigningNote::NewL
       
    73 // Two-phased constructor.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 CDigSigningNote* CDigSigningNote::NewL()
       
    77     {
       
    78     CDigSigningNote* self = new( ELeave ) CDigSigningNote;
       
    79     
       
    80     CleanupStack::PushL( self );
       
    81     self->ConstructL();
       
    82     CleanupStack::Pop( self );
       
    83 
       
    84     return self;
       
    85     }
       
    86 
       
    87     
       
    88 // Destructor
       
    89 CDigSigningNote::~CDigSigningNote()
       
    90     {
       
    91 	delete iSenderBuffer;
       
    92 	delete iBufferData;
       
    93     }
       
    94 
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CDigSigningNote::?member_function
       
    98 // ?implementation_description
       
    99 // (other items were commented in a header).
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CDigSigningNote::SaveSignedText( 
       
   103     const TDesC& aSignedText, 
       
   104     TRequestStatus& aStatus )
       
   105     {
       
   106     InitClientStatus(aStatus);
       
   107 
       
   108     iSenderBuffer->Reset();
       
   109 	RBufWriteStream stream;
       
   110 	CleanupClosePushL( stream );
       
   111 	stream.Open( *iSenderBuffer );
       
   112 
       
   113 	stream.WriteInt32L( ESaveReceipt );
       
   114     stream.WriteInt32L( aSignedText.Length() );
       
   115 	stream << aSignedText;
       
   116 
       
   117     // new stuff begin
       
   118 	delete iBufferData;
       
   119 	iBufferData = NULL;
       
   120 	iBufferData = HBufC8::NewL( iSenderBuffer->Ptr(0).Size() );
       
   121 	iBufferData->Des() = iSenderBuffer->Ptr(0);
       
   122     // new stuff end
       
   123 	CleanupStack::PopAndDestroy(); // stream.close;
       
   124 	RequestDialog(*iBufferData);
       
   125     }
       
   126 // -----------------------------------------------------------------------------
       
   127 // CDigSigningNote::?member_function
       
   128 // ?implementation_description
       
   129 // (other items were commented in a header).
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void CDigSigningNote::ShowPINBlockedInfo( 
       
   133     const TPINLabel& aLabel, 
       
   134     TRequestStatus& aStatus )
       
   135     {
       
   136     InitClientStatus(aStatus);
       
   137 
       
   138     iSenderBuffer->Reset();
       
   139 	RBufWriteStream stream;
       
   140 	CleanupClosePushL( stream );
       
   141 	stream.Open( *iSenderBuffer );
       
   142 
       
   143 	stream.WriteInt32L( EPinCodeBlockedInfo );
       
   144 	stream << aLabel;
       
   145     // new stuff begin
       
   146 	delete iBufferData;
       
   147 	iBufferData = NULL;
       
   148 	iBufferData = HBufC8::NewL( iSenderBuffer->Ptr(0).Size() );
       
   149 	iBufferData->Des() = iSenderBuffer->Ptr(0);
       
   150     // new stuff end
       
   151 	CleanupStack::PopAndDestroy(); // stream.close;
       
   152 	RequestDialog(*iBufferData);
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // CDigSigningNote::ShowNote
       
   157 // ?implementation_description
       
   158 // (other items were commented in a header).
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void CDigSigningNote::ShowNote( 
       
   162     MDigSigningNote::TNoteType aNoteType, 
       
   163     TRequestStatus& aStatus )
       
   164     {
       
   165     ShowNoteL( aStatus, aNoteType );
       
   166     }
       
   167 // -----------------------------------------------------------------------------
       
   168 // CDigSigningNote::Release
       
   169 //
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 void CDigSigningNote::Release()
       
   173     {
       
   174     delete this;
       
   175     }
       
   176 
       
   177 //  End of File