emailuis/emailui/sendasmtm/fsmtms/uidata/inc/cfsuidatamtm.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Definition of the class CFsUiDataMtm.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CFSUIDATAMTM_H
       
    20 #define CFSUIDATAMTM_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <mtudcbas.h>
       
    24 
       
    25 // =========
       
    26 // Templates
       
    27 // =========
       
    28 template <class T> class CleanupResetAndDestroyClose
       
    29     {
       
    30 public:
       
    31     inline static void PushL(T& aRef);
       
    32 private:
       
    33     static void Close(TAny *aPtr);
       
    34     };
       
    35 
       
    36 template <class T> inline void CleanupResetAndDestroyClosePushL(T& aRef);
       
    37 
       
    38 template <class T> inline void CleanupResetAndDestroyClose<T>::PushL(T& aRef)
       
    39     {
       
    40     CleanupStack::PushL(TCleanupItem(&Close, &aRef));
       
    41     }
       
    42 
       
    43 template <class T> void CleanupResetAndDestroyClose<T>::Close(TAny *aPtr)
       
    44     {
       
    45     static_cast<T*>(aPtr)->ResetAndDestroy();
       
    46     static_cast<T*>(aPtr)->Close();
       
    47     }
       
    48 
       
    49 template <class T> inline void CleanupResetAndDestroyClosePushL(T& aRef)
       
    50     {
       
    51     CleanupResetAndDestroyClose<T>::PushL(aRef);
       
    52     }
       
    53 
       
    54 /**
       
    55 *  Base class for UI Data MTM components.
       
    56 *
       
    57  * @since S60 3.1
       
    58  * @lib fsuidatamtm.lib 
       
    59 */
       
    60 class CFsUiDataMtm :
       
    61     public CBaseMtmUiData, public MMsvSessionObserver
       
    62     {
       
    63 public: // New Functions
       
    64     /**
       
    65     * Factory method. Called from MTM ui data registry.
       
    66     */
       
    67     IMPORT_C static CFsUiDataMtm* NewL(
       
    68         CRegisteredMtmDll& aRegisteredMtmDll);
       
    69 
       
    70 
       
    71 private: // From CBaseMtmUiData
       
    72     HBufC* StatusTextL(const TMsvEntry& aContext) const;
       
    73     
       
    74     TInt QueryCapability(TUid aFunctionId, TInt& aResponse) const;
       
    75     
       
    76     TInt OperationSupportedL(
       
    77         TInt aOperationId, const TMsvEntry& aContext) const;
       
    78 
       
    79     TBool CanUnDeleteFromEntryL(
       
    80         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    81 
       
    82     TBool CanViewEntryL(
       
    83         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    84 
       
    85     TBool CanReplyToEntryL(
       
    86         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    87 
       
    88     TBool CanOpenEntryL(
       
    89         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    90 
       
    91     TBool CanForwardEntryL(
       
    92         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    93 
       
    94     TBool CanEditEntryL(
       
    95         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
    96 
       
    97     TBool CanDeleteServiceL(
       
    98         const TMsvEntry& aService, TInt& aReasonResourceId) const;
       
    99 
       
   100     TBool CanDeleteFromEntryL(
       
   101         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
   102 
       
   103     TBool CanCreateEntryL(
       
   104         const TMsvEntry& aParent,
       
   105         const TMsvEntry& aNewEntry, TInt& aReasonResourceId) const;
       
   106 
       
   107     TBool CanCreateEntryL(
       
   108         const TMsvEntry& aParent,
       
   109         TMsvEntry& aNewEntry, TInt& aReasonResourceId) const;
       
   110 
       
   111     TBool CanCopyMoveToEntryL(
       
   112         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
   113 
       
   114     TBool CanCopyMoveFromEntryL(
       
   115         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
   116 
       
   117     TBool CanCloseEntryL(
       
   118         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
   119 
       
   120     TBool CanCancelL(
       
   121         const TMsvEntry& aContext, TInt& aReasonResourceId) const;
       
   122 
       
   123     const CBitmapArray& ContextIcon(
       
   124         const TMsvEntry& aContext, TInt aStateFlags) const;
       
   125 
       
   126     const CArrayFix<TMtmUiFunction>& MtmSpecificFunctions() const;
       
   127 
       
   128 private: // From CBaseMtmUiData
       
   129     void GetResourceFileName(TFileName& aFileName) const;
       
   130     
       
   131     void PopulateArraysL();
       
   132 
       
   133 private: // From MMsvSessionObserver
       
   134     void HandleSessionEventL(
       
   135         TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
   136 
       
   137 private: // Constructor & Destructor
       
   138 	/**
       
   139 	 * Constructor.
       
   140 	 *
       
   141 	 * @param aRegisteredMtmDll  To access self registry information.
       
   142 	 */
       
   143 	CFsUiDataMtm(CRegisteredMtmDll& aRegisteredMtmDll);
       
   144 
       
   145 	/**
       
   146      * Second phase constructor.
       
   147      */    
       
   148     void ConstructL();
       
   149     
       
   150     ~CFsUiDataMtm();
       
   151 
       
   152 private: // Data
       
   153 	RArray<TUint> iMailboxIds;
       
   154 
       
   155     };
       
   156 
       
   157 
       
   158 #endif // CFSUIDATAMTM_H
       
   159 // End of File
       
   160