diff -r 000000000000 -r 094583676ce7 PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationRequest.h Thu Dec 17 08:41:52 2009 +0200 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2005 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: Container of the one reactive authorization request +* +*/ + +#ifndef __CPENGAUTHORIZATIONREQUEST_H__ +#define __CPENGAUTHORIZATIONREQUEST_H__ + +// INCLUDES +#include "CPEngAuthorizationItem.h" +#include "MPEngAuthorizationRequest.h" +#include + + +// FORWARD DECLARATION +class MPEngAuthorizationManagerSet; + + +// CLASS DECLARATION +/** + * Container of the one reactive authorization request + * + * @lib PEngListLib2 + * @since 3.0 + */ +class CPEngAuthorizationRequest : public CPEngAuthorizationItem, + public MPEngAuthorizationRequest + { + public: // Constructors and destructor + + /** + * Two-phased constructor, + */ + static CPEngAuthorizationRequest* NewLC( const TDesC& aUserId, + TInt& aSize ); + + /** + * Two-phased constructor, constructs class from the Stream + */ + static CPEngAuthorizationRequest* NewLC( RReadStream& aStream, + TInt& aSize ); + + /** + * Destructor. + */ + virtual ~CPEngAuthorizationRequest(); + + + public: // From CPEngAuthorizationItem + + /** + * Update local flag. + * @see + */ + void DoUpdateLocalFlags( const CPEngAuthorizationItem& aSource ); + + + + public: // From MPEngAuthorizationRequest + + /** + * User id of the user who requested authorization + * @see + */ + const TDesC& UserId() const; + + + /** + * List of request attributes + * @see + */ + const RArray& RequestedAttributes() const; + + + /** + * State of the authorization + * @see + */ + MPEngAuthorizationRequest::TPEngAuthorizationRequestState AuthorizationState() const; + + + /** + * State of the authorization response + * @see + */ + MPEngAuthorizationRequest::TPEngAuthorizationResponseType AuthorizationResponse() const; + + + /** + * List of authorized attributes + * @see + */ + const RArray& AuthorizedAttributes() const; + + + /** + * Set authorization response + * @see + */ + void SetAuthorizedAttributesL( TArray& aAttributes, + TBool aKeepOldAuthorization = ETrue ); + + void DenyAuthorizationL(); + + void CancelAuthorizationL(); + + + + /** + * Removes buffered authorization response + * @see + */ + void RemoveAuthorizationResponse(); + + + /** + * Extension interface. + * @see + */ + MPEngAuthorizationRequestExt* Extension() { + return NULL; + }; + const MPEngAuthorizationRequestExt* Extension() const { + return NULL; + }; + + + + public: // Authorization update + + /** + * Set Authorization manager pointer + * + * @since 3.0 + * @param aAuthManager authorization manager + */ + void SetAuthorizationManager( MPEngAuthorizationManagerSet* aAuthManager ); + + + /** + * Update authorization state + * + * @since 3.0 + * @param aState new state of authorization request + */ + void SetAuthState( TPEngAuthorizationRequestState aState ); + + + /** + * Update authorization response + * + * @since 3.0 + * @param aResponse new response of authorization request + */ + void SetAuthResponse( TPEngAuthorizationResponseType aResponse ); + + /** + * Update authorized Attributes + * + * @since 3.0 + * @param aAuthorizedAttr authorized attributes + */ + void UpdateAuthorizedAttributesL( const RArray& aAuthorizedAttr ); + + + /** + * Set requested attributes for authorization + * + * @since 3.0 + * @param aRequestedAttr + */ + void UpdateRequestedAttributesL( const RArray& aRequestedAttr ); + + + /** + * Add Attribute to the requested attributes + * + * @since 3.0 + * @param aAttribute attribute to add to requested attributes + */ + void AddRequestedAttributeL( TUint32 aAttribute ); + + + /** + * Externalize to the given stream + * @since 3.0 + * @param aStream write stream + */ + void ExternalizeL( RWriteStream& aStream ) const ; + + + /** + * Internalize from the given stream + * @since 3.0 + * @param aStream read stream + */ + void InternalizeL( RReadStream& aStream ); + + + + /** + * Compare function toe use with RPointerArray. + * + * Two instances are compared based on the TDesC.CompareF function + * of the requesting Id + * + * @since 3.0 + * @param aFirst fist class for comparison + * @param aSecond second class for comparison + * @return -1 if fist is smaller, + * +1 is second is smaller, + * 0 if they are same + */ + static TInt Compare( const CPEngAuthorizationRequest& aFirst, + const CPEngAuthorizationRequest& aSecond ); + + + private: // constructors + + /** + * C++ constructor. + */ + CPEngAuthorizationRequest( TInt& aSize ); + + /** + * Symbian constructor + */ + void ConstructL( const TDesC& aUserId ); + + + private: // Data + + /// OWN: State of authorization + TPEngAuthorizationRequestState iState; + + /// OWN: Authorization response type + TPEngAuthorizationResponseType iResponseType; + + /// OWN: Request Attributes + RArray iRequestedAttr; + + /// OWN: Authorized Attributes + RArray iAuthorizedAttr; + + /// REF: Authorization manager + MPEngAuthorizationManagerSet* iAuthManager; + }; + +#endif // __CPENGAUTHORIZATIONREQUEST_H__ + +// End of File +