emailservices/emailframework/commonlib/inc/CFSMailFolderBase.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:02:40 +0200
changeset 4 e7aa27f58ae1
parent 0 8466d47a6819
child 8 e1b6206813b4
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2007-2009 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:  common email folder base object
*
*/


#ifndef __FSMAILFOLDERBASE_H
#define __FSMAILFOLDERBASE_H

#include "CFsMailMessage.h"
#include "cemailextensionbase.h"

/**
 *  class for handling mailbox folder data
 *
 *  @lib FSFWCommonLib

 */
class CFSMailFolderBase : public CExtendableEmail
{
 public:
    
    /**
     * Two-phased constructor.
     *
     * @param aFolderId folder id in plugin containing folder
     */
     IMPORT_C static CFSMailFolderBase* NewL(const TFSMailMsgId aFolderId);
    
    /**
     * Two-phased constructor.
     *
     * @param aFolderId folder id in plugin containing folder
     */
     IMPORT_C static CFSMailFolderBase* NewLC(const TFSMailMsgId aFolderId);

    /**
     * Destructor.
     *
     */  
     IMPORT_C virtual ~CFSMailFolderBase();

    /**
     * folder id accessor
     *
     * @return folder id
     */
     IMPORT_C TFSMailMsgId GetFolderId() const;

    /**
     * parent folder id accessor
     *
     * @return parent folder id
     */
     IMPORT_C TFSMailMsgId GetParentFolderId() const;

    /**
     * parent folder id mutator
     *
     * @param aFolderId parent folder id to be set
     */
     IMPORT_C void SetParentFolderId( const TFSMailMsgId aFolderId );

    /**
     * folder name accessor
     *
     * @return folder name
     */
     IMPORT_C TDesC& GetFolderName() const;

    /**
     * Folder name mutator. Note ! Some clients may ignore names set for
     * standard folders (TFSFolderType being EFSInbox, EFSOutbox, EFSDraftsFolder,
     * EFSSentFolder, or EFSDeleted) and display own localized names for them.
     * E.g. Email UI behaves this way.
     *
     * @param aFolderName folder name to be set
     */
     IMPORT_C void SetFolderName(const TDesC& aFolderName);

    /**
     * folder type accessor
     *
     * @return folder type
     */
     IMPORT_C TFSFolderType GetFolderType() const;

    /**
     * folder type mutator
     *
     * @param aFolderType folder type to be set
     */
     IMPORT_C void SetFolderType( const TFSFolderType aFolderType );

    /**
     * returns id of mailbox containing this folder
     *
     * @return mailbox id
     */
     IMPORT_C TFSMailMsgId GetMailBoxId() const;

    /**
     * folder mailbox id mutator
     *
     * @param aMailBoxId mailbox id to be set
     */
     IMPORT_C void SetMailBoxId( const TFSMailMsgId aMailBoxId );

    /**
     * returns message count contained by this folder
     *
     * @return message count
     */
     IMPORT_C TUint GetMessageCount() const;

    /**
     * returns unread message count contained by this folder
     *
     * @return unread message count
     */
     IMPORT_C TUint GetUnreadCount() const;

    /**
     * returns unseen message count contained by this folder
     *
     * @return unseen message count
     */
     IMPORT_C TUint GetUnseenCount() const;

    /**
     * returns subfolder count contained by this folder
     *
     * @return subfolder count
     */
     IMPORT_C TUint GetSubFolderCount() const;

    /**
     * set message count contained by this folder
     *
     * @param aMessageCount message count
     */
     IMPORT_C void SetMessageCount( const TUint aMessageCount );

    /**
     * set unread message count contained by this folder
     *
     * @param aMessageCount unread message count
     */
     IMPORT_C void SetUnreadCount( const TUint aMessageCount );

    /**
     * set unseen message count contained by this folder
     *
     * @param aMessageCount unseen message count
     */
     IMPORT_C void SetUnseenCount( const TUint aMessageCount );

    /**
     * set subfolder count contained by this folder
     *
     * @param subfolder count
     */
     IMPORT_C void SetSubFolderCount( const TUint aMessageCount );

    /**
     * blocks copying to this folder from given folder types
     *
     * @param aFolderTypes blocked folder types
     * @param aMailBoxStatus mailbox status (online / offline) when
     * blocking is done
     */
     IMPORT_C void BlockCopyFromL( RArray<TFSFolderType> aFolderTypes, 
                                    TFSMailBoxStatus aMailBoxStatus );
    /**
     * blocks moving to this folder from given folder types
     *
     * @param aFolderTypes blocked folder types
     * @param aMailBoxStatus mailbox status (online / offline) when
     * blocking is done
     */
     IMPORT_C void BlockMoveFromL( RArray<TFSFolderType> aFolderTypes, 
                                    TFSMailBoxStatus aMailBoxStatus );

protected:

    /**
     * C++ default constructor.
     */
     CFSMailFolderBase();

    /**
     * folder id
     */
     TFSMailMsgId             iFolderId;

    /**
     * blocked folders in copying
     */
     RArray<TFSFolderType>    iCopyOfflineBlocked;
     RArray<TFSFolderType>    iCopyOnlineBlocked;

    /**
     * blocked folders in moving
     */
     RArray<TFSFolderType>    iMoveOfflineBlocked;
     RArray<TFSFolderType>    iMoveOnlineBlocked;

private:

    /**
     * Two-phased constructor
     */
    void ConstructL( const TFSMailMsgId aFolderId );

private: // data

    /**
     * folder name
     */
     HBufC*                   iFolderName;

    /**
     * folder type
     */
     TFSFolderType            iFolderType;

    /**
     * folder total message count 
     */
     TUint                    iMessageCount;

    /**
     * folder unread message count 
     */
     TUint                    iUnreadMessageCount;

    /**
     * folder unseen message count 
     */
     TUint                    iUnseenCount;

    /**
     * mailbox id
     */
     TFSMailMsgId             iMailBoxId;


    /**
     * parent folder id
     */
     TFSMailMsgId             iParentFolderId;

    /**
     * subfolder count 
     */
     TUint                    iSubFolderCount;
};

#endif // __FSMAILFOLDERBASE_H