williamr@2: /* williamr@2: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Public ECom notification API for NcnList. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __MNCNNOTIFICATION_H__ williamr@2: #define __MNCNNOTIFICATION_H__ williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@4: #include williamr@4: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: williamr@2: // UID of this interface williamr@2: const TUid KNcnNotificationInterfaceUid = {0x101f8855}; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Public ECom notification API. williamr@2: * This API allows the notification of new message(s) to the NcnList. williamr@2: * It's main purpose is to provide a mechanism for an email MTM to broadcast the arrival of new messages williamr@2: * and give the user an opportunity to navigate to the email folder williamr@2: * williamr@2: * Example usage williamr@2: * williamr@2: * @code williamr@2: * #include // CDesCArray williamr@2: * #include // ECOM interface to notification system williamr@2: * williamr@2: * // Get an instance of the ECOM interface to the notification system. williamr@2: * MNcnNotification* notifyNewMessageEcom = 0; williamr@2: * TRAP(err, notifyNewMessageEcom = MNcnNotification::CreateMNcnNotificationL()); williamr@2: * williamr@2: * // Check for errors williamr@2: * if(notifyNewMessageEcom && err == KErrNone) williamr@2: * { williamr@2: * // The interface is supported on this phone. williamr@2: * CleanupDeletePushL(notifyNewMessageEcom); williamr@2: * williamr@2: * // Now notify the framework that new messages have been received williamr@2: * // First create a descriptor array for aInfo - even though it isn't used presently. williamr@2: * CDesCArray* tempArray = new (ELeave) CDesCArrayFlat(3); williamr@2: * CleanupStack::PushL(tempArray); williamr@2: * williamr@2: * // Notify the framework that there are new messages. williamr@2: * // This can return an error value. williamr@2: * err = notifyNewMessageEcom->NewMessages(aServiceId, MNcnNotification::EIndicationNormal, *tempArray); williamr@2: * williamr@2: * // Cleanup the descriptor array. williamr@2: * CleanupStack::PopAndDestroy(tempArray); williamr@2: * williamr@2: * // Clean up the ECOM interface now. williamr@2: * CleanupStack::PopAndDestroy(notifyNewMessageEcom); williamr@2: * } williamr@2: * @endcode williamr@2: * williamr@2: * The example above shows the interface object being created and then destroyed immediately after use. williamr@2: * However, it is not necessary to create a new interface object for every function call. It is done here to williamr@2: * demonstrate correct useage of the CleanupStack williamr@2: */ williamr@2: class MNcnNotification williamr@2: { williamr@2: private: // Enumerations williamr@2: /** williamr@2: * Indication type bit enumeration. williamr@2: */ williamr@2: enum TIndicationTypeBits williamr@2: { williamr@2: /* Icon bit */ williamr@2: EIndicationIconBit = 0x1, williamr@2: williamr@2: /* Tone bit */ williamr@2: EIndicationToneBit = 0x2, williamr@2: williamr@2: /* Soft note bit */ williamr@2: EIndicationSoftNoteBit = 0x4 williamr@2: }; williamr@2: williamr@2: public: // Enumerations williamr@2: /** williamr@2: * Indication type enumeration. williamr@2: */ williamr@2: enum TIndicationType williamr@2: { williamr@2: /* Icon indication */ williamr@2: EIndicationIcon = EIndicationIconBit, williamr@2: williamr@2: /* Normal indication */ williamr@2: EIndicationNormal = EIndicationIconBit | EIndicationToneBit | EIndicationSoftNoteBit, williamr@2: williamr@2: /* Tone and icon indication */ williamr@2: EIndicationToneAndIcon = EIndicationIconBit | EIndicationToneBit williamr@2: }; williamr@2: williamr@2: public: // Constructor and destructor williamr@2: williamr@2: /** williamr@2: * ECom implementation class factory method. williamr@2: * Caller takes the ownership of the created object. williamr@2: * If interface needs to be pushed into CleanupStack, williamr@2: * remember to use the CleanupDeletePushL() function! williamr@2: * DO NOT USE CleanupStack::PushL()!! williamr@2: * @return ECom implementation instance williamr@2: * williamr@2: * williamr@2: */ williamr@2: static MNcnNotification* CreateMNcnNotificationL(); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: virtual ~MNcnNotification(); williamr@2: williamr@2: public: // Interface williamr@2: williamr@2: /** williamr@2: * Called by Messaging Server -compatible 3rd party Email plugins williamr@2: * to inform NcnList that there is a new message (or more than one message). williamr@2: * It should not (necessarily) be called for each new message but, say, at the williamr@2: * end of synchronisation when one or more new messages have been received. williamr@2: * It displays a 'New email' message with softkeys allowing direct williamr@2: * navigation to the email folder williamr@2: * Parameter aInfo is reserved for future use and is not handled in any way currently. williamr@2: * Implementation of aIndicationType may vary between devices williamr@2: * williamr@2: * @param aMailBox The service id of the email MTM williamr@2: * @param aIndicationType Indication type for new messages. May be any combination williamr@2: * of enumeration TIndicationType values. williamr@2: * @param aInfo Optional info about message (subject, sender etc.). Not supported williamr@2: * williamr@2: * @return KErrNone for success, or system error code williamr@2: */ williamr@2: virtual TInt NewMessages( const TMsvId& aMailBox, williamr@2: TIndicationType aIndicationType, williamr@2: const MDesCArray& aInfo ) = 0; williamr@2: williamr@2: /** williamr@2: * Called by Messaging Server -compatible 3rd party Email plugins williamr@2: * wanting to make a request to mark certain new messages as unread.
williamr@2: * Essentially, it sets the new message counter to zero for the given mailbox
williamr@2: * The new messages become 'old' messages but they remain marked as 'unread'. williamr@2: * @param aMailBox The id identifying the mailbox or mail williamr@2: * folder containing the message(s) to be marked as unread. williamr@2: * williamr@2: * @return KErrNone for success, or some error code williamr@2: */ williamr@2: virtual TInt MarkUnread( const TMsvId& aMailBox ) = 0; williamr@2: williamr@2: private: // data williamr@2: williamr@2: // for ECom to identify plug-in instance williamr@2: TUid iDtor_ID_Key; williamr@2: }; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif // __MNCNNOTIFICATION_H__ williamr@2: williamr@2: // End of File