pkiutilities/CertmanUi/SRC/Certmanuidialogs.cpp
changeset 1 d5423fbb4f29
parent 0 164170e6151a
child 8 ece4bbb094df
equal deleted inserted replaced
0:164170e6151a 1:d5423fbb4f29
     1 /*
     1 /*
     2 * Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:   Implementation of class CertManUIDialogs
    14 * Description:   Implementation of class CertManUIDialogs
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <AknWaitDialog.h>
    18 #include <AknWaitDialog.h>
    22 #include <certmanui.rsg>
    19 #include <certmanui.rsg>
    23 #include "Certmanuidialogs.h"
    20 #include "Certmanuidialogs.h"
    24 #include "CertManUILogger.h"
    21 #include "CertManUILogger.h"
    25 #include "CertmanuiCommon.h"
    22 #include "CertmanuiCommon.h"
    26 
    23 
    27 
       
    28 #ifdef _DEBUG
    24 #ifdef _DEBUG
    29 _LIT( KDesCertmanUiFault, "CertmanUi" );
    25 _LIT( KDesCertmanUiFault, "CertmanUi" );
    30 #endif
    26 #endif
       
    27 
    31 
    28 
    32 // ================= MEMBER FUNCTIONS =======================
    29 // ================= MEMBER FUNCTIONS =======================
    33 
    30 
    34 // ---------------------------------------------------------
    31 // ---------------------------------------------------------
    35 // CCertManUiDialog::CCertManUiDialogs()
    32 // CCertManUiDialog::CCertManUiDialogs()
    36 // Default c++ constructor
       
    37 // ---------------------------------------------------------
    33 // ---------------------------------------------------------
       
    34 //
    38 CCertManUIWaitDialog::CCertManUIWaitDialog()
    35 CCertManUIWaitDialog::CCertManUIWaitDialog()
    39     {
    36     {
    40     iDialog = NULL;
       
    41     }
    37     }
    42 
    38 
    43 // ---------------------------------------------------------
    39 // ---------------------------------------------------------
    44 // CCertManUiDialog::~CCertManUiDialogs()
    40 // CCertManUiDialog::~CCertManUiDialogs()
    45 // Destructor
       
    46 // ---------------------------------------------------------
    41 // ---------------------------------------------------------
       
    42 //
    47 CCertManUIWaitDialog::~CCertManUIWaitDialog()
    43 CCertManUIWaitDialog::~CCertManUIWaitDialog()
    48     {
    44     {
    49     if ( iDialog )
    45     if( iDialog )
    50         {
    46         {
    51         delete iDialog;
    47         delete iDialog;
       
    48         iDialog = NULL;
    52         }
    49         }
    53     }
    50     }
    54 
    51 
    55 //---------------------------------------------------------------
    52 //---------------------------------------------------------------
    56 // CCertManUiDialog::StartWaitDialogL
    53 // CCertManUiDialog::StartWaitDialogL()
    57 // Displays wait dialog
       
    58 //---------------------------------------------------------------
    54 //---------------------------------------------------------------
       
    55 //
    59 void CCertManUIWaitDialog::StartWaitDialogL( TInt aDialogSelector )
    56 void CCertManUIWaitDialog::StartWaitDialogL( TInt aDialogSelector )
    60     {
    57     {
    61     CERTMANUILOGGER_ENTERFN( "CCertManUIWaitDialog::StartWaitDialogL" );
    58     CERTMANUILOGGER_ENTERFN( "CCertManUIWaitDialog::StartWaitDialogL" );
    62     TInt dialog = 0;
       
    63 
    59 
    64     // If iDisplayed flag is true, but iDialog is NULL we have had leave.
    60     if( !iDialog )
    65     // Reset iDisplayed to normalize situation
       
    66     if(iDisplayed && iDialog == NULL)
       
    67         {
    61         {
    68         iDisplayed = EFalse;
    62         iDialog = new( ELeave ) CAknWaitDialog( reinterpret_cast< CEikDialog** >( &iDialog ) );
    69         }
       
    70 
    63 
    71     if(!iDisplayed)
    64         TInt dialog = 0;
    72         {
    65         switch( aDialogSelector )
    73         if( !iDialog )
       
    74            {
       
    75             iDialog = new ( ELeave )CAknWaitDialog( REINTERPRET_CAST(CEikDialog**,
       
    76                 &iDialog), ETrue );	
       
    77            } 
       
    78 
       
    79 
       
    80         //CleanupStack::PushL(TCleanupItem(CleanupWaitDialog, (TAny**)&iDialog));
       
    81 
       
    82         switch(aDialogSelector)
       
    83             {
    66             {
    84             case ECertmanUiDeleteDialog:
    67             case ECertmanUiDeleteDialog:
    85                 LOG_WRITE("Show delete note");
    68                 LOG_WRITE( "Show delete note" );
    86                 dialog = R_CERTMANUI_DELETE_WAIT_NOTE;
    69                 dialog = R_CERTMANUI_DELETE_WAIT_NOTE;
    87                 break;
    70                 break;
    88 
    71 
    89             case ECertmanUiWaitDialog:
    72             case ECertmanUiWaitDialog:
    90                 LOG_WRITE("Show wait note");
    73                 LOG_WRITE( "Show wait note" );
    91                 dialog = R_CERTMANUI_WAIT_NOTE;
    74                 dialog = R_CERTMANUI_WAIT_NOTE;
    92                 break;
    75                 break;
       
    76 
    93             default:
    77             default:
    94                 __ASSERT_DEBUG( EFalse, User::Panic(KDesCertmanUiFault,
    78                 __ASSERT_DEBUG( EFalse, User::Panic( KDesCertmanUiFault, EBadDialogSelector ) );
    95                     EBadDialogSelector));
       
    96                 break;
    79                 break;
    97             }
    80             }
    98 
    81 
    99         iDialog->ExecuteLD(dialog);
    82         iDialog->ExecuteLD( dialog );
   100         iDisplayed = ETrue;
       
   101         }
    83         }
       
    84 
       
    85     ++iOpenCount;
   102 
    86 
   103     CERTMANUILOGGER_LEAVEFN( "CCertManUIWaitDialog::StartWaitDialogL" );
    87     CERTMANUILOGGER_LEAVEFN( "CCertManUIWaitDialog::StartWaitDialogL" );
   104     }
    88     }
   105 
    89 
   106 //---------------------------------------------------------------
    90 //---------------------------------------------------------------
   107 // CCertManUiDialog::CloseWaitDialogL
    91 // CCertManUiDialog::CloseWaitDialogL
   108 // Close wait dialog
       
   109 //---------------------------------------------------------------
    92 //---------------------------------------------------------------
       
    93 //
   110 void CCertManUIWaitDialog::CloseWaitDialogL()
    94 void CCertManUIWaitDialog::CloseWaitDialogL()
   111     {
    95     {
   112     CERTMANUILOGGER_ENTERFN( "CCertManUIWaitDialog::CloseWaitDialogL" );
    96     CERTMANUILOGGER_ENTERFN( "CCertManUIWaitDialog::CloseWaitDialogL" );
   113 
    97 
   114     if( iDialog )
    98     --iOpenCount;
       
    99 
       
   100     if( iDialog && !iOpenCount )
   115         {
   101         {
   116         iDialog->ProcessFinishedL();
   102         TRAPD( err, iDialog->ProcessFinishedL() );
   117         //CleanupStack::PopAndDestroy();
   103         if( !err )
       
   104             {
       
   105             delete iDialog;
       
   106             iDialog = NULL;
       
   107             }
   118         }
   108         }
   119 
   109 
   120     iDisplayed = EFalse;
       
   121     CERTMANUILOGGER_LEAVEFN( "CCertManUIWaitDialog::CloseWaitDialogL" );
   110     CERTMANUILOGGER_LEAVEFN( "CCertManUIWaitDialog::CloseWaitDialogL" );
   122     }
   111     }
   123 
   112 
   124 // ---------------------------------------------------------
       
   125 // CCertManUIWaitDialog::CleanupWaitDialog
       
   126 //
       
   127 // ---------------------------------------------------------
       
   128 void CCertManUIWaitDialog::CleanupWaitDialog(TAny* aAny)
       
   129     {
       
   130     CERTMANUILOGGER_ENTERFN( "CCertManUIWaitDialog::CleanupWaitDialog" );
       
   131 
       
   132     CAknWaitDialog** dialog = (CAknWaitDialog**) aAny;
       
   133     if ( dialog && *dialog )
       
   134         {
       
   135         delete *dialog;
       
   136         }
       
   137     CERTMANUILOGGER_LEAVEFN( "CCertManUIWaitDialog::CleanupWaitDialog" );
       
   138     }
       
   139 
       
   140 
       
   141 // End of file