calendarui/inc/calencommandhandler.h
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef MCALENCOMMANDHANDLER_H
       
    19 #define MCALENCOMMANDHANDLER_H
       
    20 
       
    21 
       
    22 
       
    23 #include "calencontext.h"
       
    24 #include "caleninstanceid.h"
       
    25 
       
    26 // Local class used wrap the current command and information
       
    27 // to restore the current context
       
    28 class TCalenCommand
       
    29     {
       
    30     public:
       
    31         TCalenCommand();
       
    32         void SetCommandAndContextL( int aCommand,
       
    33                                      MCalenContext& aContext);
       
    34 
       
    35         TInt Command() const;
       
    36         void GetContextL( MCalenContext& aContext ) const ;
       
    37 
       
    38     private:
       
    39         int iCommand;
       
    40         QDateTime iFocusDateAndTime;
       
    41         TCalenInstanceId iInstanceId;
       
    42     };
       
    43 
       
    44 inline TCalenCommand::TCalenCommand()
       
    45     {
       
    46     }
       
    47 
       
    48 inline void TCalenCommand::SetCommandAndContextL( int aCommand,
       
    49                                                              MCalenContext& aContext)
       
    50     {
       
    51     iCommand = aCommand;
       
    52     iFocusDateAndTime = aContext.focusDateAndTime();
       
    53     iInstanceId = aContext.instanceId();
       
    54     }
       
    55 
       
    56 inline TInt TCalenCommand::Command() const
       
    57     {
       
    58     return iCommand;
       
    59     }
       
    60 
       
    61 inline void TCalenCommand::GetContextL( MCalenContext& aContext ) const
       
    62     {
       
    63     aContext.setFocusDateAndTimeAndInstance( iFocusDateAndTime,
       
    64                                               iInstanceId );
       
    65     }
       
    66 
       
    67 
       
    68 
       
    69 /**
       
    70  * MCalenCommandHandler is an interface for a customisation
       
    71  * to populate a menupane and toolbar and handle any commands
       
    72  */
       
    73 class MCalenCommandHandler
       
    74     {
       
    75 public:
       
    76     virtual TBool HandleCommandL( const TCalenCommand& aCommand ) = 0;
       
    77     };
       
    78 
       
    79 #endif // MCALENCOMMANDHANDLER_H
       
    80 
       
    81 // End of file