calendarui/inc/calencommandhandler.h
author hgs
Mon, 28 Jun 2010 15:22:02 +0530
changeset 45 b6db4fd4947b
parent 18 c198609911f9
permissions -rw-r--r--
201025

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
 *
*/

#ifndef MCALENCOMMANDHANDLER_H
#define MCALENCOMMANDHANDLER_H



#include "calencontext.h"
#include "caleninstanceid.h"

// Local class used wrap the current command and information
// to restore the current context
class TCalenCommand
    {
    public:
        TCalenCommand();
        void SetCommandAndContextL( int aCommand,
                                     MCalenContext& aContext);

        TInt Command() const;
        void GetContextL( MCalenContext& aContext ) const ;

    private:
        int iCommand;
        QDateTime iFocusDateAndTime;
        TCalenInstanceId iInstanceId;
    };

inline TCalenCommand::TCalenCommand()
    {
    }

inline void TCalenCommand::SetCommandAndContextL( int aCommand,
                                                             MCalenContext& aContext)
    {
    iCommand = aCommand;
    iFocusDateAndTime = aContext.focusDateAndTime();
    iInstanceId = aContext.instanceId();
    }

inline TInt TCalenCommand::Command() const
    {
    return iCommand;
    }

inline void TCalenCommand::GetContextL( MCalenContext& aContext ) const
    {
    aContext.setFocusDateAndTimeAndInstance( iFocusDateAndTime,
                                              iInstanceId );
    }



/**
 * MCalenCommandHandler is an interface for a customisation
 * to populate a menupane and toolbar and handle any commands
 */
class MCalenCommandHandler
    {
public:
    virtual TBool HandleCommandL( const TCalenCommand& aCommand ) = 0;
    };

#endif // MCALENCOMMANDHANDLER_H

// End of file