emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsif.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2008 - 2009 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:  handles interface to LIW and Content Publishing Service
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMAILCPSIF_H_
       
    20 #define CMAILCPSIF_H_
       
    21 
       
    22 // LIW interface
       
    23 #include <LiwServiceHandler.h>
       
    24 #include <LiwVariant.h>
       
    25 #include <LiwGenericParam.h>
       
    26 #include <fbs.h>
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 #include "cmailcpshandler.h"
       
    30 #include "cmailcpsifconsts.h"
       
    31 
       
    32 /**
       
    33  *  CMail ContentPublishingService interface class
       
    34  *  Class implementing interface towards LIW FW and Content Publishing Service
       
    35  *
       
    36  *  @lib fsmailserver.exe
       
    37  *  @since S60 v5.1
       
    38  */
       
    39 NONSHARABLE_CLASS( CMailCpsIf ) : public CBase, public MLiwNotifyCallback
       
    40     {
       
    41 public:
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      */
       
    45     static CMailCpsIf* NewL( CMailCpsHandler* aMailCpsHandler );
       
    46 
       
    47     /**
       
    48     * Destructor.
       
    49     */
       
    50     ~CMailCpsIf();
       
    51 
       
    52     /**
       
    53      * Publishes setup text and action to launch setup wizard
       
    54      */
       
    55     void PublishSetupWizardL(TInt instance);
       
    56     
       
    57     /**
       
    58      * Publishes mailbox name to widget and action to launch CMail UI
       
    59      * @param aRowNumber specifies the row on widget UI
       
    60      * @param aMailboxName contains name of the mailbox
       
    61      */
       
    62     void PublishActiveMailboxNameL( const TInt aInstance, 
       
    63 									const TInt aRowNumber, 
       
    64                                     const TDesC& aMailboxName,
       
    65                                     const TInt aMailBoxCount,
       
    66                                     TFSMailMsgId aMailBoxId,
       
    67                                     TFSMailMsgId aFolderId );
       
    68 
       
    69     /**
       
    70      * Resets mailbox name from widget
       
    71      * @param aRowNumber specifies the row on widget UI
       
    72      */
       
    73 //    void ResetActiveMailboxNameL( const TInt aRowNumber );
       
    74 
       
    75     /**
       
    76      * Publishes unseen or outbox icon
       
    77      */
       
    78     void PublishIndicatorIconL( const TInt aInstance, 
       
    79                                 const TInt aRowNumber,
       
    80                                 const TInt aIcon );
       
    81     
       
    82     /**
       
    83      * 
       
    84      */
       
    85     void PublishMailboxIconL( const TInt aInstance, const TInt aRowNumber, const TInt aIcon, TFSMailMsgId aMailBoxId );
       
    86 
       
    87     /**
       
    88      * 
       
    89      */    
       
    90     void PublishMailDetailL(
       
    91             const TInt aInstance,
       
    92             const TInt aRowNumber, 
       
    93             const TDesC& aSender,
       
    94             TWidgetMailDetails aDetail);
       
    95     
       
    96     /**
       
    97      * Resets mail header data
       
    98      * @param aRowNumber specifies the row on widget UI
       
    99      */
       
   100     void ResetMessageL( TInt aRowNumber );
       
   101 
       
   102     /**
       
   103      * 
       
   104      */
       
   105 	void PublisherRegisteryActionL();
       
   106 
       
   107     /**
       
   108      * 
       
   109      */	
       
   110     void RegisterForObserverL();
       
   111 
       
   112     /**
       
   113      * 
       
   114      */	
       
   115     void UnRegisterForObserverL();
       
   116 
       
   117     /**
       
   118      * 
       
   119      */	
       
   120 	TInt HandleNotifyL(
       
   121         TInt aErrorCode,
       
   122         TInt aEventId,
       
   123         CLiwGenericParamList& aEventParamList,
       
   124         const CLiwGenericParamList& aInParamList );
       
   125 
       
   126     /**
       
   127      * 
       
   128      */		
       
   129 	TBool PublisherStatusL(const CLiwGenericParamList& aEventParamList);
       
   130 
       
   131     /**
       
   132      * 
       
   133      */
       
   134 	TBool AllowedToPublish( TInt aWidgetInstance );
       
   135 	
       
   136     /**
       
   137      * Sets configuration data to publisher interface
       
   138      * CpsIf uses this
       
   139      * @param aRowNumber specifies the row on widget UI
       
   140      */
       
   141 	void SetConfiguration( const TInt32 aConfigData );
       
   142 
       
   143     /**
       
   144      * 
       
   145      */	
       
   146 	TInt GetWidgetInstanceCount();
       
   147 	
       
   148 private:
       
   149     
       
   150     CMailCpsIf( CMailCpsHandler* aMailCpsHandler );
       
   151     void ConstructL();
       
   152 
       
   153     /**
       
   154      * adds resource file
       
   155      */
       
   156     void CMailCpsIf::AllocateResourcesL();
       
   157     
       
   158     /**
       
   159      * initializes the LIW IF
       
   160      * @return instance of LIW IF
       
   161      */
       
   162     MLiwInterface* GetMessagingInterfaceL( );
       
   163 
       
   164     /**
       
   165      * Gets published item's ID from LIW. Id is later used e.g. when reseting values 
       
   166      * @param aInParamList parameter list returned from LIW IF
       
   167      * @return Id
       
   168      */
       
   169     TUint ExtractItemId( const CLiwGenericParamList& aInParamList );
       
   170     
       
   171     /**
       
   172      * Publishes descriptor
       
   173      * @param aPublisherId id of the publisher
       
   174      * @param aContentType content type of the published data
       
   175      * @param aContentId content id of the published data
       
   176      * @param aTextToAdd data to be published
       
   177      * @param aKey key of the added descriptor
       
   178      * @param aTrigger optional trigger tag
       
   179      * @param aUid optional app uid (app to be launched)
       
   180      * @return Id
       
   181      */
       
   182     TUint PublishDescriptorL(
       
   183         const TDesC& aPublisherId, 
       
   184         const TDesC& aContentType, 
       
   185         const TDesC& aContentId, 
       
   186         const TDesC& aTextToAdd,
       
   187         const TDesC& aKey,
       
   188         const TDesC8& aTrigger,
       
   189         const TInt aMailBoxCount,
       
   190         TFSMailMsgId aMailBoxId,
       
   191         TFSMailMsgId aFolderId );
       
   192 
       
   193     /**
       
   194      * Publishes image
       
   195      * @param aContentId
       
   196      * @param aResult
       
   197      * @param aBitmapId
       
   198      * @param aBitmapMaskId
       
   199      * @param aMailBoxId
       
   200      */
       
   201 
       
   202     void PublishImageL(
       
   203          const TDesC& aContentId,
       
   204          const TDesC& aContentType,
       
   205          const TDesC8& aKey,
       
   206          TInt aBitmapId,
       
   207          TInt aBitmapMaskId,
       
   208          TFSMailMsgId aMailBoxId );
       
   209 
       
   210     /**
       
   211      * Removes a published entity from Content Publishing Service
       
   212      * @param aId of the published data
       
   213      */
       
   214     void RemoveL( TUint aId );
       
   215 
       
   216     /**
       
   217      * 
       
   218      */	    
       
   219     TInt FindWidgetInstanceId(const TDesC& aContentId);
       
   220 public:
       
   221 	//
       
   222     RPointerArray<HBufC>    iInstIdList;
       
   223 private:
       
   224 	CMailCpsHandler*		iMailCpsHandler; //uses
       
   225     // LIW IF
       
   226     MLiwInterface* 			iMsgInterface;
       
   227     // LIW Service handler
       
   228     CLiwServiceHandler* 	iServiceHandler;
       
   229     // resource file offset
       
   230     TInt                    iResourceFileOffset;
       
   231     // UIDS of the published entities
       
   232     TUint 					iMailboxNameUid;
       
   233     // message count of a mailbox
       
   234     TUint 					iMessageCountUid;
       
   235     // row count
       
   236     TUint 					iRowCountUid;
       
   237     // message header details id
       
   238     TUint 					iMsgUid;
       
   239     // setup text and action id
       
   240     TUint 					iSetupUid;
       
   241 	// is content allowed to publish	
       
   242 	TBool 					iAllowedToPublish[KMaxMailboxCount];
       
   243     // is widget inactive    
       
   244     TBool                   iInactive[KMaxMailboxCount];	
       
   245 	// From configuration: are homescreen notifications observed or ignored
       
   246 	TBool                   iIgnoreHsNotifications;
       
   247     };
       
   248 
       
   249 #endif /*CMAILCPSIF_H_*/