diff -r 12af337248b1 -r bd7edf625bdd meetingui/meetingrequestviewers/src/CMRCancelModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/meetingui/meetingrequestviewers/src/CMRCancelModel.cpp Wed Sep 01 12:32:31 2010 +0100 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2002-2004 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: Model for method CANCEL +* +*/ + + + + +// INCLUDE FILES +#include "CMRCancelModel.h" +#include "CMRModelBase.h" +#include "ProcessingStructs.h" //meeting request scenarios +#include "MMRDataFillerInterface.h" +#include "MREntryConsultant.h" +#include "CMRProcessor.h" +#include "CMRDataFillerCancel.h" +#include //CEikonEnv +#include //rich bio +#include "CMRUtilsInternal.h" //MR utils +#include +#include // resouce identifiers +#include "meetingrequestviewers.hrh" +#include //mailbox id's +#include "MRViewersPanic.h" //panic enums +#include // resource identifiers + +// CONSTANTS +/// Unnamed namespace for local definitions +namespace { + +_LIT( KPanicMsg, "CMRCancelModel" ); + +void Panic( TPanicCode aReason ) + { + User::Panic( KPanicMsg, aReason ); + } +} // namespace + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?classname::?classname +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMRCancelModel::CMRCancelModel( + CMRMailboxUtils& aMRMailboxUtils, + CMRUtilsInternal& aMRUtils, + const MAgnEntryUi::TAgnEntryUiInParams& aInParams ) + : CMRModelBase( aMRMailboxUtils, aMRUtils, aInParams ) + { + } + +// ----------------------------------------------------------------------------- +// ?classname::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMRCancelModel::ConstructL( RPointerArray& aEntries ) + { + CMRModelBase::ConstructL( aEntries ); + } + +// ----------------------------------------------------------------------------- +// ?classname::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMRCancelModel* CMRCancelModel::NewL( + RPointerArray& aEntries, + CMRMailboxUtils& aMRMailboxUtils, + CMRUtilsInternal& aMRUtils, + const MAgnEntryUi::TAgnEntryUiInParams& aInParams) + { + CMRCancelModel* self = new( ELeave ) CMRCancelModel( aMRMailboxUtils, + aMRUtils, + aInParams ); + + CleanupStack::PushL( self ); + self->ConstructL( aEntries ); + CleanupStack::Pop(); + + return self; + } + +// Destructor +CMRCancelModel::~CMRCancelModel() + { + } + +MMRModelInterface::TClosingStatus CMRCancelModel::ClosingStatusL() + { + TClosingStatus retVal( ENone ); + return retVal; + } + +MMRDataFillerInterface* CMRCancelModel::DataFillerL(CRichBio* aRichBio) + { + __ASSERT_DEBUG( aRichBio, Panic( ECRichBioNull ) ); + MMRDataFillerInterface* dataFillerInterface(NULL); + dataFillerInterface = CMRDataFillerCancel::NewL( *aRichBio, + *this, + *CEikonEnv::Static(), + iMRMailboxUtils, + iInParams ); + return dataFillerInterface; + } + +TBool CMRCancelModel::IsCmdAvailableL( TInt aCommandId ) + { + TInt retVal( EFalse ); + switch ( aCommandId ) + { + case EMRCommandReplyToOrganiser: + { + retVal = CanReplyToOrganiserL(); + break; + } + case EMRCommandReplyToSender: + { + retVal = CanReplyToSenderL(); + break; + } + case EMRCommandReplyToAll: + { + retVal = CanReplyToAllL(); + break; + } + case EMRCommandForward: + { + retVal = CanForwardL(); + break; + } + case EMRCommandRemoveFromCalendar: + { + retVal = CanRemoveFromCalendarL(); + break; + } + default: + { + retVal = CMRModelBase::IsCmdAvailableL( aCommandId ); + break; + } + } + return retVal; + } + +TBool CMRCancelModel::CanReplyToOrganiserL() + { + TBool retVal( EFalse ); + if ( iMRProcessor->OwnerRole() != CMRProcessor::EOrganiser ) + { + retVal = ETrue; + } + return retVal; + } + +TBool CMRCancelModel::CanReplyToSenderL() + { + TBool retVal( EFalse ); + if ( iInParams.iCallingApp.iUid == KUidMailApplication ) + { + if ( iMRProcessor->OwnerRole() != CMRProcessor::EOrganiser ) + { // can reply to sender if sender is not also organizer + retVal = !IsSenderOrganizerL(); + } + } + return retVal; + } + +TBool CMRCancelModel::CanReplyToAllL() + { + return ETrue; + } + +TBool CMRCancelModel::CanForwardL() + { + TBool retVal( EFalse ); + const CCalEntry& entry = *( CombinedEntry() ); + if ( iInParams.iCallingApp.iUid == KUidMailApplication && + IsEntryUsableL( entry ) ) + { + return ETrue; + } + return retVal; + } + +TBool CMRCancelModel::CanRemoveFromCalendarL() + { + const CCalEntry& entry = *( CombinedEntry() ); + return MREntryConsultant::ExistsInDbL( entry, iMRUtils ); + } + +// End of File