pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp
changeset 0 164170e6151a
child 21 09b1ac925e3f
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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:   Generic CT Query Dialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "CTQueryDialog.h"
       
    23 #include "CTSecurityDialogsLogger.h"
       
    24 #include <CTSecDlgs.rsg>
       
    25 #include <uikon/eiksrvui.h>
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCTQueryDialog::CCTQueryDialog()
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CCTQueryDialog::CCTQueryDialog( TRequestStatus& aClienStatus, TBool& aRetVal, const TDesC& aQueryText, TInt aDlgButtonResourceId, const TCTQueryDialogType aDlgType):
       
    37 CAknQueryDialog(
       
    38     aDlgType == ECTConfirmationDialog ? EConfirmationTone : 
       
    39     aDlgType == ECTErrorDialog ? EErrorTone : 
       
    40     aDlgType == ECTWarningDialog ? EWarningTone : ENoTone),
       
    41     iDlgType(aDlgType),
       
    42     iDlgButtonResourceId(aDlgButtonResourceId),
       
    43     iQueryText(aQueryText), 
       
    44     iClientStatus(&aClienStatus), 
       
    45     iRetVal(aRetVal)
       
    46     {
       
    47     }
       
    48 // ---------------------------------------------------------
       
    49 // CCTQueryDialog::~CCTQueryDialog()
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 
       
    53 CCTQueryDialog::~CCTQueryDialog()
       
    54     {
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CCTQueryDialog::RunDlgLD
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CCTQueryDialog::RunDlgLD(TRequestStatus& aClienStatus, TBool& aRetVal, const TDesC& aQueryText, TInt aDlgButtonResourceId, const TCTQueryDialogType aDlgType )
       
    62     {
       
    63 	CCTQueryDialog* self = new (ELeave) CCTQueryDialog(aClienStatus, aRetVal, aQueryText, aDlgButtonResourceId, aDlgType);
       
    64 	self->ExecuteLD(R_WIM_QUERY_DIALOG);
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // CCTQueryDialog::PreLayoutDynInitL
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 void CCTQueryDialog::PreLayoutDynInitL()
       
    72     {
       
    73 	SetPromptL(iQueryText);
       
    74 
       
    75 	CAknQueryDialog::PreLayoutDynInitL();
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CCTQueryDialog::PostLayoutDynInitL
       
    80 // ---------------------------------------------------------
       
    81 //
       
    82 void CCTQueryDialog::PostLayoutDynInitL()
       
    83     {
       
    84 	CAknQueryControl* control = STATIC_CAST(CAknQueryControl*,ControlOrNull(EGeneralQuery));
       
    85 
       
    86 	TInt animResource = 0;
       
    87 	TInt softKeyResource = 0;
       
    88 	switch (iDlgType)
       
    89 	{
       
    90 		case ECTConfirmationDialog:
       
    91 			animResource = R_QGN_NOTE_QUERY_ANIM;
       
    92 			softKeyResource = R_AVKON_SOFTKEYS_YES_NO;
       
    93 			break;
       
    94 		case ECTErrorDialog:
       
    95 			animResource = R_QGN_NOTE_ERROR_ANIM;
       
    96 			softKeyResource = R_AVKON_SOFTKEYS_OK_EMPTY;
       
    97 			break;
       
    98 		case ECTInfoDialog:
       
    99 			animResource = R_QGN_NOTE_INFO_ANIM;
       
   100 			softKeyResource = R_AVKON_SOFTKEYS_OK_EMPTY;
       
   101 			break;
       
   102 		case ECTWarningDialog:
       
   103 			animResource = R_QGN_NOTE_WARNING_ANIM;
       
   104 			softKeyResource = R_AVKON_SOFTKEYS_OK_EMPTY;
       
   105 			break;
       
   106 		case ECTOkDialog:
       
   107 			animResource = R_QGN_NOTE_OK_ANIM;
       
   108 			softKeyResource = R_AVKON_SOFTKEYS_OK_EMPTY;
       
   109 			break;
       
   110 		default:
       
   111 			animResource = R_QGN_NOTE_QUERY_ANIM;
       
   112 			softKeyResource = iDlgButtonResourceId == 0 ? R_AVKON_SOFTKEYS_OK_EMPTY : iDlgButtonResourceId;
       
   113 			break;
       
   114 	}
       
   115 
       
   116 	control->SetAnimationL(animResource);
       
   117 	ButtonGroupContainer().SetCommandSetL(softKeyResource);
       
   118 
       
   119 	CAknQueryDialog::PostLayoutDynInitL();
       
   120     ((CEikServAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(ETrue);
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // CCTQueryDialog::OkToExitL
       
   125 // ---------------------------------------------------------
       
   126 //
       
   127 TBool CCTQueryDialog::OkToExitL( TInt aButtonId )
       
   128     {
       
   129 
       
   130     if ( aButtonId == EEikBidCancel || aButtonId == EAknSoftkeyNo )
       
   131         {
       
   132 
       
   133 		iRetVal = EFalse;
       
   134 		User::RequestComplete(iClientStatus, KErrNone); 
       
   135 		
       
   136         }
       
   137     else if ( aButtonId ==EAknSoftkeyYes || aButtonId == EAknSoftkeyOk)
       
   138         {
       
   139 		
       
   140 		iRetVal = ETrue;
       
   141 		User::RequestComplete(iClientStatus, KErrNone); 		
       
   142         
       
   143         }
       
   144      ((CEikServAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(EFalse);
       
   145 
       
   146      return ETrue; 
       
   147     }
       
   148 
       
   149 // End of File