emailuis/emailui/inc/FSEmailLauncherItem.h
changeset 0 8466d47a6819
child 4 e7aa27f58ae1
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:  Launcher item plugin API definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __FSEMAILLAUNCHERITEM_H__
       
    20 #define __FSEMAILLAUNCHERITEM_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ecom.h>
       
    24 #include <badesca.h>
       
    25 #include <AknIconUtils.h>
       
    26 
       
    27 /**
       
    28  * UID of this ECOM interface.
       
    29  */
       
    30 // <cmail> S60 UID update
       
    31 const TUid KFSEmailLauncherItemUid = {0x2001E285};
       
    32 // </cmail> S60 UID update
       
    33 
       
    34 class MFSEmailLauncherItemObserver 
       
    35     { 
       
    36 public: 
       
    37 
       
    38     /** 
       
    39      * Gets called when an item requests an view refresh. The launcher should
       
    40      * re-read all cached data from the item plug-in interface.
       
    41      */ 
       
    42     virtual void RefreshLauncherViewL() = 0; 
       
    43     };
       
    44 
       
    45 class CFSEmailLauncherItem : public CBase
       
    46     {
       
    47 public: 
       
    48 
       
    49     /**
       
    50      * Constructs CFSEmailLauncherItem.
       
    51      *
       
    52      * @param aImplementationUid UID of the implementation to be constructed.
       
    53      * @param aObserver Observer for refreshing launcher view.
       
    54      * @return Launcher item.
       
    55      */
       
    56     static CFSEmailLauncherItem* NewL(
       
    57         TUid aImplementationUid,
       
    58         MFSEmailLauncherItemObserver* aObserver );
       
    59 
       
    60     /**
       
    61      * Destructor
       
    62      */
       
    63     virtual ~CFSEmailLauncherItem();
       
    64 
       
    65     /**
       
    66 	 * Request a list of all available implementations which satisfy this
       
    67 	 * given interface.
       
    68 	 *
       
    69      * @param aImplInfoArray Info array of implementations.
       
    70 	 */
       
    71 	static void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray );
       
    72 
       
    73 public:
       
    74 
       
    75     /**
       
    76 	 * Set observer for refreshing launcher view.
       
    77 	 *
       
    78      * @param aObserver Observer for refreshing launcher view.
       
    79 	 */
       
    80     virtual void SetObserver( MFSEmailLauncherItemObserver* aObserver ) = 0;
       
    81 
       
    82     /**
       
    83      * Returns the ID of the item. The IDs are allocated by the EMail UI
       
    84      * project. The IDs are used to match the plug-in API implementations with
       
    85      * the placeholders, so that we get the items to the correct locations on
       
    86      * the grid defined in the UI spec. The implementation could also return
       
    87      * some constant in which case the UI would place the item at the end of
       
    88      * the grid or something. 
       
    89      *
       
    90      * @return Id of the item.
       
    91      */ 
       
    92     virtual TInt Id() const = 0;
       
    93 
       
    94     /**
       
    95      * Returns the icon displayed in the launcher grid. The UI will call
       
    96      * SetSize for it with appropriate values to accomodate to different
       
    97      * screen sizes.
       
    98      *
       
    99      * @return Icon to be displayed.
       
   100      */ 
       
   101     virtual CAknIcon* Icon() const = 0;
       
   102 
       
   103     /**
       
   104      * Returns a long or short caption for the item that gets displayed in the
       
   105      * UI.
       
   106      *
       
   107      * @param aLongCaption If EFalse, the short caption is returned.
       
   108      * @return Caption for the item.
       
   109      */ 
       
   110     virtual TPtrC Caption( TBool aLongCaption ) const = 0;
       
   111 
       
   112     /**
       
   113      * Returns information about whether the item should be visible or not.
       
   114      *
       
   115      * @return Visibility of the item. 
       
   116      */ 
       
   117     virtual TBool IsVisible() const = 0;
       
   118 
       
   119     /**
       
   120      * Gets called if the user selects the item.
       
   121      */ 
       
   122     virtual void ExecuteActionL() = 0;
       
   123 
       
   124 private:
       
   125 
       
   126     /** 
       
   127      * Instance identifier key.
       
   128      */
       
   129     TUid iDtor_ID_Key;
       
   130     };
       
   131 
       
   132 
       
   133 inline CFSEmailLauncherItem::~CFSEmailLauncherItem()
       
   134     {
       
   135     // Inform the ECOM framework that this specific instance of the interface
       
   136     // has been destroyed.
       
   137     REComSession::DestroyedImplementation(iDtor_ID_Key);
       
   138     }
       
   139 
       
   140 inline CFSEmailLauncherItem* CFSEmailLauncherItem::NewL(
       
   141         TUid aImplementationUid,
       
   142         MFSEmailLauncherItemObserver* aObserver )
       
   143     {
       
   144     TAny* ptr = REComSession::CreateImplementationL(
       
   145         aImplementationUid,
       
   146         _FOFF( CFSEmailLauncherItem, iDtor_ID_Key ) );
       
   147 
       
   148     CFSEmailLauncherItem* item = REINTERPRET_CAST( CFSEmailLauncherItem*, ptr );
       
   149 
       
   150     item->SetObserver( aObserver );
       
   151 
       
   152     // The type of TAny* ptr should be CFSEmailLauncherItem.
       
   153     return item;
       
   154     }
       
   155 
       
   156 inline void CFSEmailLauncherItem::ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray )
       
   157 	{
       
   158 	REComSession::ListImplementationsL( KFSEmailLauncherItemUid, aImplInfoArray );
       
   159 	}
       
   160 
       
   161 #endif // __FSEMAILLAUNCHERITEM_H__