meetingui/meetingrequestviewers/src/CMRDialogBase.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:   Base dialog for meeting request views
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "CMRDialogBase.h"
       
    23 #include "ICalUILog.h"
       
    24 #include "MMRModelInterface.h" //MR model interface
       
    25 #include <MAgnEntryUi.h> //entry ui callback interface
       
    26 #include <MRCommands.hrh>
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // ?classname::?classname
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CMRDialogBase::CMRDialogBase(
       
    37     MAgnEntryUiCallback& aHandlerCallback )
       
    38     : iHandlerCallback( aHandlerCallback )
       
    39     {
       
    40     }
       
    41 
       
    42 // Destructor
       
    43 CMRDialogBase::~CMRDialogBase()
       
    44     {
       
    45     }
       
    46     
       
    47 TInt CMRDialogBase::ExecuteLD()
       
    48 	{
       
    49 	return KErrNone;
       
    50 	}
       
    51     
       
    52 void CMRDialogBase::SetModel( MMRModelInterface& aMRModel )
       
    53     {
       
    54     iMRModel = &aMRModel;
       
    55     TRAP_IGNORE( HandleSetModelL() );
       
    56     }
       
    57     
       
    58 void CMRDialogBase::HandleSetModelL()
       
    59     {
       
    60     // Nothing done by default, subclasses may override
       
    61     }
       
    62 
       
    63 //-----------------------------------------------------------------------------
       
    64 //  CMRDialogBase::IsDlgExitingCmd()
       
    65 // In case of EMRCommandForward mail framework closes icalui after cmd handling
       
    66 //-----------------------------------------------------------------------------
       
    67 TBool CMRDialogBase::IsDlgExitingCmd( TInt aCommandId )
       
    68     {
       
    69     TBool retVal( EFalse );
       
    70     switch ( aCommandId )
       
    71         {
       
    72         //intentional fallthrough
       
    73 		case EMRCommandShowDescriptionView:
       
    74 		case EMRCommandShowAttendeesView:
       
    75 		case EMRCommandRemoveFromCalendar:
       
    76 		case EMRCommandSend:
       
    77 		case EMRCommandSendUpdate:
       
    78 		case EMRCommandCancelMR:
       
    79 		case EMRCommandDeleteMR:
       
    80 		case EMRCommandRespondAccept:
       
    81 		case EMRCommandRespondTentative:
       
    82 		case EMRCommandRespondDecline:
       
    83 		case EMRCommandReplyToSender:
       
    84 		case EMRCommandReplyToOrganiser:
       
    85 		case EMRCommandReplyToAll:
       
    86 	    case EAknCmdExit:
       
    87 	    case EEikCmdExit:        
       
    88             {
       
    89             retVal = ETrue;
       
    90             break;
       
    91             }
       
    92         default:
       
    93             {
       
    94             retVal = EFalse;
       
    95             break;
       
    96             }
       
    97         }
       
    98     return retVal;
       
    99     }
       
   100     
       
   101 //-----------------------------------------------------------------------------
       
   102 //  CMRDialogBase::ProcessCommandL()
       
   103 //-----------------------------------------------------------------------------
       
   104 void CMRDialogBase::ProcessCommandL( TInt aCommandId )
       
   105 	{
       
   106 	LOG("CMRDialogBase::ProcessCommandL");
       
   107 	HideMenu();
       
   108 	
       
   109 	TInt ret = iHandlerCallback.ProcessCommandWithResultL( aCommandId );
       
   110 	if ( IsDlgExitingCmd( aCommandId ) && ret == KErrNone )
       
   111 	    {
       
   112         LOG("CMRDialogBase::ProcessCommandL, calling TryExitL");
       
   113 	    TryExitL( aCommandId );
       
   114 	    LOG("CMRDialogBase::ProcessCommandL, TryExitL called");
       
   115 	    }
       
   116     LOG("CMRDialogBase::ProcessCommandL -> End");	
       
   117 	}
       
   118 
       
   119 //-----------------------------------------------------------------------------
       
   120 //  CMRDialogBase::OkToExitL()
       
   121 //-----------------------------------------------------------------------------
       
   122 TBool CMRDialogBase::OkToExitL( TInt aButtonId )
       
   123 	{
       
   124 	LOG("CMRDialogBase::OkToExitL");
       
   125 	TInt retVal( ETrue );
       
   126 	if ( aButtonId == EAknSoftkeyOptions )
       
   127 		{
       
   128 		// we want to dynamically handle the opening of options menu
       
   129 		DisplayMenuL();
       
   130 	 	retVal = EFalse;
       
   131 		}
       
   132     else
       
   133         {
       
   134 	    LOG("CMRDialogBase::OkToExitL, calling HandleDlgExitingL");
       
   135         TInt cmdToPerform( HandleDlgExitingL( aButtonId ) );
       
   136         if ( cmdToPerform != EEikCmdCanceled )
       
   137             {            
       
   138             LOG("CMRDialogBase::OkToExitL, calling ProcessCommandL");
       
   139 		    iHandlerCallback.ProcessCommandL( cmdToPerform );
       
   140             }
       
   141 		retVal = ETrue;
       
   142 	    }
       
   143     LOG("CMRDialogBase::OkToExitL -> End");
       
   144     return retVal;
       
   145 	}
       
   146     
       
   147 //  End of File