bearermanagement/mpm/src/mpmconfirmdlg.cpp
changeset 0 5a93021fdf25
child 19 22c3c67e5001
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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: Confirm Dialog implementation
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file mpmconfirmdlg.cpp
       
    20 UI Note Handler implementation
       
    21 */
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include "mpmconfirmdlg.h"
       
    25 #include "mpmlogger.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMPMConfirmDlg::NewL
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CMPMConfirmDlg* CMPMConfirmDlg::NewL( CArrayPtrFlat<CMPMDialogBase>& aQueue,
       
    34                                       MMPMConfirmDlg&     aConfirmDlgUser,
       
    35                                       const TUint32       aSnapId,
       
    36                                       const TUint32       aIAP,
       
    37                                       const TDialogType   aDialogType )
       
    38     {
       
    39     CMPMConfirmDlg* self = new ( ELeave ) CMPMConfirmDlg( aQueue,
       
    40                                                           aConfirmDlgUser,
       
    41                                                           aSnapId,
       
    42                                                           aIAP,
       
    43                                                           aDialogType );
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     CleanupStack::Pop( self );
       
    47     return self;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CMPMConfirmDlg::CMPMConfirmDlg
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CMPMConfirmDlg::CMPMConfirmDlg( CArrayPtrFlat<CMPMDialogBase>& aQueue,
       
    55                                 MMPMConfirmDlg&     aConfirmDlgUser,
       
    56                                 const TUint32       aSnapId,
       
    57                                 const TUint32       aIAP,
       
    58                                 const TDialogType   aDialogType )
       
    59     : CMPMDialogBase( *(CArrayPtrFlat<CMPMDialogBase>*)&aQueue ),
       
    60       iConfirmDlgUser( aConfirmDlgUser),
       
    61       iSnapId( aSnapId ),
       
    62       iIAP( aIAP ),
       
    63       iDialogType( aDialogType ),
       
    64       iUtils( NULL ),
       
    65       iResult( EMsgQueryCancelled )
       
    66     {
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CMPMConfirmDlg::ConstructL
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void CMPMConfirmDlg::ConstructL()
       
    74     {
       
    75     iUtils = CConnectionUiUtilities::NewL();
       
    76     CMPMDialogBase::ConstructL();
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CMPMConfirmDlg::Start
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CMPMConfirmDlg::Start( CMPMDialogBase* aDlg )
       
    84     {
       
    85     //  Start the dialog if previous dialog does not exist: !aDlg
       
    86     //  OR
       
    87     //  if ConfirmDlgResponse is not accepted by the iConfirmDlgUser.
       
    88     //
       
    89     if ( !aDlg || !iConfirmDlgUser.ConfirmDlgResponse( &((CMPMConfirmDlg*)aDlg)->iConfirmDlgUser ) )
       
    90         {
       
    91         MPMLOGSTRING3( "CMPMConfirmDlg::Start Display dialog: SNAP %d, IAP %d", 
       
    92                        iSnapId, iIAP )
       
    93 
       
    94         switch ( iDialogType )
       
    95             {
       
    96             case EConfirmDlgHomeNetwork:
       
    97                 {                
       
    98                 MPMLOGSTRING( "    normal confirm dialog" )
       
    99                 iUtils->ConfirmMethodUsageQuery( iResult,
       
   100                                                  true,
       
   101                                                  iStatus);
       
   102                 break;
       
   103                 }
       
   104                 
       
   105             case EConfirmDlgVisitorNetwork:
       
   106                 {
       
   107                 MPMLOGSTRING( "    normal confirm dialog" )
       
   108                 iUtils->ConfirmMethodUsageQuery( iResult,
       
   109                                                  false,
       
   110                                                  iStatus);
       
   111                 break;
       
   112                 }
       
   113                 
       
   114             default: 
       
   115                 {
       
   116                 return;
       
   117                 }
       
   118             }
       
   119         SetActive();
       
   120         }
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CMPMConfirmDlg::~CMPMConfirmDlg
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 CMPMConfirmDlg::~CMPMConfirmDlg()
       
   128     {
       
   129     MPMLOGSTRING( "CMPMConfirmDlg::~CMPMConfirmDlg" )
       
   130 
       
   131     Cancel();
       
   132     delete iUtils;
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CMPMConfirmDlg::RunL
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 void CMPMConfirmDlg::RunL()
       
   140     {
       
   141     if ( iStatus.Int() != KErrNone )
       
   142         {
       
   143         MPMLOGSTRING2( "CMPMConfirmDlg::RunL status %d", iStatus.Int() )
       
   144         }
       
   145     iConfirmDlgUser.ConfirmDlgResponse( iStatus.Int(), iResult );
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CMPMConfirmDlg::DoCancel
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 void CMPMConfirmDlg::DoCancel()
       
   153     {
       
   154     MPMLOGSTRING( "CMPMConfirmDlg::DoCancel" )
       
   155     MPMLOGSTRING( "    Cancel normal confirm dialog" )
       
   156 
       
   157     iUtils->CancelConfirmMethodUsageQuery();
       
   158     }
       
   159 
       
   160 // End of file