phoneapp/phoneuiview/src/cphonenote.cpp
changeset 0 5f000ab63145
child 15 2a26698d78ba
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 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 CPhoneNote class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cphonenote.h"
       
    21 #include "phoneui.hrh"
       
    22 #include <featmgr.h>
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 // C++ default constructor can NOT contain any code, that
       
    26 // might leave.
       
    27 //
       
    28 CPhoneNote::CPhoneNote( CEikDialog** aSelfPtr, MEikCommandObserver& aCommandObserver ) :
       
    29     CAknNoteDialog( aSelfPtr ),
       
    30     iCommandObserver( aCommandObserver ) 
       
    31     {
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // Destructor
       
    36 // ---------------------------------------------------------
       
    37 // 
       
    38 CPhoneNote::~CPhoneNote()
       
    39     {
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------
       
    43 // CPhoneNote::OfferKeyEventL
       
    44 // ---------------------------------------------------------
       
    45 //
       
    46 TKeyResponse CPhoneNote::OfferKeyEventL( 
       
    47     const TKeyEvent& aKeyEvent,
       
    48     TEventCode /*aType*/ )
       
    49     {
       
    50 	if ( ( aKeyEvent.iScanCode == EStdKeyNo || aKeyEvent.iCode == EKeyNo )
       
    51 		&& iNoteType != EPhoneNoteSecurity )
       
    52 		{
       
    53 		OkToExitL( EPhoneCmdWaitNoteOk );
       
    54 		return EKeyWasNotConsumed;
       
    55 		}        
       
    56 	else
       
    57 		{
       
    58 		// Let key events be handled by the application
       
    59 	    return EKeyWasNotConsumed;		
       
    60 		}
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------
       
    64 // CPhoneNote::OkToExitL
       
    65 // ---------------------------------------------------------
       
    66 //
       
    67 TBool CPhoneNote::OkToExitL( TInt aCommand )
       
    68     {
       
    69     // Let the command observer process the command
       
    70     iCommandObserver.ProcessCommandL( aCommand );
       
    71 
       
    72     return EFalse; // so that the dialog will not disappear
       
    73     }
       
    74     
       
    75 // ---------------------------------------------------------
       
    76 // CPhoneNote::SetNoteType
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 void CPhoneNote::SetNoteType( TPhoneNoteType aNoteType )
       
    80     {
       
    81     iNoteType = aNoteType;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CPhoneNote::NoteType
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 TPhoneNoteType CPhoneNote::NoteType()
       
    89     {
       
    90     return iNoteType;
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CPhoneNote::HandlePointerEventL
       
    95 // ---------------------------------------------------------
       
    96 //
       
    97 void CPhoneNote::HandlePointerEventL( 
       
    98     const TPointerEvent& aPointerEvent )
       
    99     {
       
   100     if( ( iNoteType == EPhoneNoteError ) ||
       
   101         ( iNoteType == EPhoneNoteWarning ) ||
       
   102         ( iNoteType == EPhoneNoteInformation ) ||
       
   103         ( iNoteType ==  EPhoneNoteConfirmation) ||
       
   104         ( iNoteType == EPhoneNoteCustom ))
       
   105         {
       
   106         CEikDialog::HandlePointerEventL( aPointerEvent );
       
   107         }
       
   108      }
       
   109 
       
   110 // ---------------------------------------------------------
       
   111 // CPhoneNote::UpdateSoftkeysL
       
   112 // ---------------------------------------------------------
       
   113 //
       
   114 void CPhoneNote::UpdateSoftkeysL( TInt aResourceId )
       
   115     {
       
   116     CEikButtonGroupContainer& buttonGroup = ButtonGroupContainer();
       
   117     buttonGroup.SetCommandSetL( aResourceId );
       
   118     
       
   119     buttonGroup.DrawDeferred();    
       
   120     }
       
   121 
       
   122 // End of File