messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Wrapper classes which encapsulates Message store functions
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef CONVERSATION_MSG_STORE_HANDLER_H
       
    19 #define CONVERSATION_MSG_STORE_HANDLER_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <msvapi.h>
       
    23 #include <ccsdefs.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CMsvSession;
       
    27 class MMsvSessionObserver;
       
    28 class DraftsModel;
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 class ConversationMsgStoreHandler: public MMsvSessionObserver
       
    33     {
       
    34 public:
       
    35     
       
    36     /*
       
    37      * Draft processing states
       
    38      */
       
    39     enum TDraftHandlerState
       
    40         {
       
    41         EReadDrafts,
       
    42         EProcessDrafts,
       
    43         EComplete
       
    44         };
       
    45 
       
    46     /**
       
    47      * Default constructor.
       
    48      */
       
    49     explicit ConversationMsgStoreHandler();
       
    50 
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     virtual ~ConversationMsgStoreHandler();
       
    55 
       
    56 private:
       
    57     
       
    58     /**
       
    59      * Initializes the ConversationMsgStoreHandler class.     
       
    60      */
       
    61     void InitL();
       
    62 
       
    63 public:
       
    64     /**
       
    65      * From MMsvSessionObserver. HandleSessionEventL.
       
    66      */
       
    67     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
       
    68             TAny* aArg3);
       
    69 public: 
       
    70     /**
       
    71      * Get MMS notification status.
       
    72      * @param aMsvId MMS notification status.
       
    73      */
       
    74     TCsMmsNotificationMsgState MmsNotificationStatus( TInt aMsvId );
       
    75     
       
    76     /**
       
    77      * Mark specified messages as unread.
       
    78      * @param aIdArray Array of message ids.
       
    79      */
       
    80     void MarkMessagesReadL(RArray<TInt>& aIdArray);
       
    81 
       
    82     /**
       
    83      * Delete specified messages from message store
       
    84      * @param aIdArray Array of message ids.
       
    85      */
       
    86     void DeleteMessages(RArray<TInt>& aIdArray);
       
    87     
       
    88     /**
       
    89      * Returns the msv session object
       
    90      * @return CMsvSession object
       
    91      */
       
    92     CMsvSession& GetMsvSession();
       
    93 
       
    94     /**
       
    95      * Start fetching all draft messages
       
    96      */
       
    97     void FetchDraftMessages(DraftsModel* draftsModel);
       
    98 
       
    99 private:
       
   100 
       
   101     /**
       
   102      * verifys the current operation status
       
   103      *@param aEntry, TMsvEntry
       
   104      */
       
   105     TBool OperationFinished( const TMsvEntry& aEntry ) const;
       
   106 
       
   107     /**
       
   108      * verifys the current operation status
       
   109      * @param aEntry, TMsvEntry
       
   110      */
       
   111     TBool OperationOngoing( const TMsvEntry& aEntry ) const;
       
   112 
       
   113     /**
       
   114      * CIdle callback
       
   115      */
       
   116     static TInt ProcessDraftMessages(TAny* arg);
       
   117 
       
   118     /**
       
   119      * State handler to read all draft messages 
       
   120      */
       
   121     TInt ProcessDraftMessagesL();
       
   122 
       
   123     /**
       
   124      * Cleanup
       
   125      */
       
   126     void CleanupL();
       
   127 
       
   128     /**
       
   129      * Checks if the MTM type supported
       
   130      */
       
   131     TBool IsMtmSupported(long uid);
       
   132 
       
   133 private: 
       
   134     /**
       
   135      * Msv Session
       
   136      * Own. 
       
   137      */
       
   138     CMsvSession* iMsvSession;
       
   139 
       
   140     /**
       
   141      * Draft entry
       
   142      * Own
       
   143      */
       
   144     CMsvEntry* iDraftEntry;
       
   145 
       
   146     /**
       
   147      * Active object
       
   148      */
       
   149     CIdle* iIdle;
       
   150 
       
   151     /**
       
   152      * Messages under root entry
       
   153      * Own
       
   154      */
       
   155     CMsvEntrySelection* iDraftMessages;
       
   156 
       
   157     /**
       
   158      * Drafts model
       
   159      * Not Own
       
   160      */
       
   161     DraftsModel *mDraftsModel;
       
   162 
       
   163     /**
       
   164      * Mesage count
       
   165      */
       
   166     TInt iDraftMessageCount;
       
   167 
       
   168     /**
       
   169      * State
       
   170      */
       
   171     TDraftHandlerState iState;
       
   172     
       
   173     };
       
   174 
       
   175 #endif // CONVERSATION_MSG_STORE_HANDLER_H
       
   176 
       
   177 // EOF