calendarui/inc/calencommandhandler.h
changeset 18 c198609911f9
child 45 b6db4fd4947b
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
       
     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         int iViewId;
       
    43     };
       
    44 
       
    45 inline TCalenCommand::TCalenCommand()
       
    46     {
       
    47     }
       
    48 
       
    49 inline void TCalenCommand::SetCommandAndContextL( int aCommand,
       
    50                                                              MCalenContext& aContext)
       
    51     {
       
    52     iCommand = aCommand;
       
    53     iFocusDateAndTime = aContext.focusDateAndTimeL();
       
    54     iInstanceId = aContext.instanceId();
       
    55     iViewId = aContext.viewId();
       
    56     }
       
    57 
       
    58 inline TInt TCalenCommand::Command() const
       
    59     {
       
    60     return iCommand;
       
    61     }
       
    62 
       
    63 inline void TCalenCommand::GetContextL( MCalenContext& aContext ) const
       
    64     {
       
    65     aContext.setFocusDateAndTimeAndInstanceL( iFocusDateAndTime,
       
    66                                               iInstanceId,
       
    67                                               iViewId );
       
    68     }
       
    69 
       
    70 
       
    71 
       
    72 /**
       
    73  * MCalenCommandHandler is an interface for a customisation
       
    74  * to populate a menupane and toolbar and handle any commands
       
    75  */
       
    76 class MCalenCommandHandler
       
    77     {
       
    78 public:
       
    79     virtual TBool HandleCommandL( const TCalenCommand& aCommand ) = 0;
       
    80     };
       
    81 
       
    82 #endif // MCALENCOMMANDHANDLER_H
       
    83 
       
    84 // End of file