cmmslcontroller.h

来自「The MMS List example demonstrates how to」· C头文件 代码 · 共 167 行

H
167
字号
/* Copyright (c) 2003, Nokia. All rights reserved */

#ifndef __CMMSLCONTROLLER_H__
#define __CMMSLCONTROLLER_H__

// INCLUDES
#include <mtuireg.h>

#include "MMmslObsInterface.h"
#include "MMmslSessionClosed.h"

// FORWARD DECLARATIONS
class CMmslModel;

/**
* This class implements the MMmslObsInterface and MMsvSessionObserver
* interfaces for observing the messaging server.
*
*/
class CMmslController : public CBase, public MMmslObsInterface,
                          public MMsvSessionObserver
    {
    public:
        /**
        * NewL
        * Two-phased constructor.
        * @param aSessionClosed An object which will be notified
        * after session problems
        */
        static CMmslController* NewL( MMmslSessionClosed& aSessionClosed );

        /**
        * ~CMmslController
        * Destructor is always virtual.
        */
        virtual ~CMmslController();

        /**
        * From MMslObsInterface,DeleteItemL
        * Delete mms from Inbox.
        * @param aItem, listbox item
        * @return KErrNone otherwise the return value is considered an error
        */
        TInt DeleteItemL( const TDesC& aItem );

        /**
        * From MMslObsInterface,ReScanAllL
        * Scan all messages in the Inbox
        * @return Number of items added (or deleted if negative),
        *     0 if no changes occurred.
        */
        TInt ReScanAllL();

        /**
        * From MMslObsInterface,SetContainer.
        * Assosiate container with observer.
        * @param aContainer, the container associated with this observer
        */
        void SetContainer( CMmslContainer* aContainer );

        /**
        * From MMslObsInterface,Model
        * @return Model assosiated with this observer
        */
        CMmslModel* Model();

        /**
        * From MMslObsInterface,GetSenderL
        * Find sender phonenumber from mms.
        * @param aItem Listbox item
        * @param aSender Sender info is set by method
        */
        void GetSenderL( const TDesC& aItem, TDes& aSender ) const;

        /**
        * From MMslObsInterface,GetMessageL.
        * Find message text.
        * @param aItem Listbox item
        * @param aMessageText Text of message is set by method
        */
        void GetMessageL( const TDesC& aItem, TDes& aMessageText ) const;

        /**
        * From MMsvSessionObserver,HandleSessionEventL.
        * Handles notifications of events from the Message Server.
        * @param aEvent The event that has taken place
        * @param aArg1 Event type-specific argument value
        * @param aArg2 Event type-specific argument value
        * @param aArg3 Event type-specific argument value
        */
        void HandleSessionEventL( TMsvSessionEvent aEvent,
            TAny* aArg1, TAny* aArg2, TAny* aArg3 );

    private:
        /**
        * CMmslController
        * C++ default constructor.
        * @param aSessionClosed An object, which will be notified
        * after session problems
        */
        CMmslController( MMmslSessionClosed& aSessionClosed );

        /**
        * ConstructL
        * By default Symbian 2nd phase constructor is private.
        */
        void ConstructL();

        /**
        * LogL
        * Update changes of Inbox into listbox
        * @param aEvent, the event that has taken place
        * @param aSelection, event happened to these entries
        * @param aParent, new parent (folder)
        * @param aOldParent, previous parent
        */
        void LogL( TMsvSessionEvent aEvent, CMsvEntrySelection* aSelection,
            TMsvId* aParent, TMsvId* aOldParent );

        /**
        * ScanFolderL
        * Read folder contents and call LogL method.
        * @param aFolderId ID of the folder.
        */
        void ScanFolderL( TMsvId aFolderId );

    private: // Data
        /**
        * Session with the messaging server.
        * Owned by this object.
        */
        CMsvSession* iSession;

        /**
        * MtmRegistry object.
        * Owned by this object.
        */
        CClientMtmRegistry* iMtmReg;

        /**
        * List of message Ids that we have logged to our model.
        * Owned by this object.
        */
        CMsvEntrySelection* iCurEntries;

        /**
        * Handle where (AppUi) to inform session problems.
        * Owned by CMmslAppUi object.
        */
        MMmslSessionClosed& iSessionClosed;

        /**
        * Pointer to container.
        * Owned by CMmslAppUi object.
        */
        CMmslContainer* iContainer;

        /**
        * Pointer to model.
        * Owned by this object.
        */
        CMmslModel* iModel;
    };

#endif	// __CMMSLCONTROLLER_H__

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?