messagingappbase/msgeditor/modelinc/MsgEditorModel.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  MsgEditorModel  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef INC_MSGEDITORMODEL_H
       
    21 #define INC_MSGEDITORMODEL_H
       
    22 
       
    23 // ========== INCLUDE FILES ================================
       
    24 
       
    25 // ========== CONSTANTS ====================================
       
    26 
       
    27 // ========== MACROS =======================================
       
    28 
       
    29 // ========== DATA TYPES ===================================
       
    30 
       
    31 // ========== FUNCTION PROTOTYPES ==========================
       
    32 
       
    33 // ========== FORWARD DECLARATIONS =========================
       
    34 
       
    35 class CBaseMtm;
       
    36 class CClientMtmRegistry;
       
    37 class CMtmUiRegistry;
       
    38 class CMtmUiDataRegistry;
       
    39 class CBaseMtmUi;
       
    40 class CBaseMtmUiData;
       
    41 class MMsgEditorModelObserver;
       
    42 
       
    43 // ========== CLASS DECLARATION ============================
       
    44 
       
    45 /**
       
    46  * Interface for message editor/viewer model module.
       
    47  *
       
    48  */
       
    49 class CMsgEditorModel : public CBase, public MMsvSessionObserver
       
    50 {
       
    51 
       
    52 public:      // new functions
       
    53 
       
    54     /**
       
    55      * Constructor.
       
    56      */
       
    57     CMsgEditorModel();
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     ~CMsgEditorModel();
       
    63 
       
    64     /**
       
    65      * 2nd phase constructor.
       
    66      */
       
    67     void ConstructL();
       
    68 
       
    69     /**
       
    70      * Set up current message entry, creates a real connection between current
       
    71      * editor/viewer session and an message entry to be displayed or edited.
       
    72      * @param aEntryId
       
    73      */
       
    74     void SetEntryL(TMsvId aEntryId);
       
    75 
       
    76     /**
       
    77      * Loads client and ui mtm's according to given message type.
       
    78      */
       
    79     void PrepareMtmL(const TUid aMtmType);
       
    80 
       
    81     /**
       
    82      * Return reference to current session.
       
    83      * @return
       
    84      */
       
    85     inline CMsvSession& Session() const;
       
    86 
       
    87     /**
       
    88      * Return reference to mtm.
       
    89      * @return
       
    90      */
       
    91     inline CBaseMtm& Mtm() const;
       
    92 
       
    93     /**
       
    94      * Return reference to mtm ui.
       
    95      * @return
       
    96      */
       
    97     CBaseMtmUi& MtmUiL();
       
    98 
       
    99     /**
       
   100      * Return reference to mtm ui data.
       
   101      * @return
       
   102      */
       
   103     CBaseMtmUiData& MtmUiDataL();
       
   104     
       
   105     /**
       
   106      * Return current message's entry.
       
   107      * @return
       
   108      */
       
   109     inline const TMsvEntry& Entry() const;
       
   110 
       
   111     /**
       
   112      * Set the editor model observer.
       
   113      * @param aObserver
       
   114      */
       
   115     inline void SetModelObserver(MMsgEditorModelObserver* aObserver);
       
   116 
       
   117     /**
       
   118      * Returns the current (the most recently known) status of the media.
       
   119      * @return
       
   120      */
       
   121     inline TBool MediaAvailable() const;
       
   122 
       
   123     /**
       
   124      * Allows changing the media availability flag stored in model.
       
   125      * @param aMediaAvailable
       
   126      */
       
   127     inline void SetMediaAvailable(TBool aMediaAvailable);
       
   128 
       
   129     /**
       
   130      *
       
   131      */
       
   132     void Wait();
       
   133 
       
   134 public:      // new public data member
       
   135 
       
   136     TInt iLaunchWait;
       
   137 
       
   138 private:     // from MMsvSessionObserver
       
   139 
       
   140     /**
       
   141      * Handles session event observer, and call event handling functions in
       
   142      * observer. Note that if additional session event handlers are defined in
       
   143      * the session, they are called before this function (as this is the
       
   144      * main session observer).
       
   145 
       
   146      * Note that the same event (especially EMsvEntriesChanged) may happen
       
   147      * several times successively when the message is saved. This is probably
       
   148      * because the editor may modify the same entry several times when saving
       
   149      * message.
       
   150      *
       
   151      * @param aEvent
       
   152      * @param aArg1
       
   153      * @param aArg2
       
   154      * @param aArg3
       
   155      */
       
   156     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
   157 
       
   158     /**
       
   159      *
       
   160      */
       
   161     void CompleteConstructL();
       
   162 
       
   163 private:     // data
       
   164 
       
   165     CMsvSession*             iSession;
       
   166     CBaseMtm*                iMtm;
       
   167     CClientMtmRegistry*      iMtmReg;
       
   168     CMtmUiRegistry*          iMtmUiReg;
       
   169     CMtmUiDataRegistry*      iMtmUiDataReg;
       
   170     CBaseMtmUi*              iMtmUi;
       
   171     MMsgEditorModelObserver* iModelObserver;
       
   172     TBool                    iMediaAvailable;
       
   173     TBool                    iWait;
       
   174     CBaseMtmUiData*          iMtmUiData;
       
   175 
       
   176 };
       
   177 
       
   178 #include "MsgEditorModel.inl"
       
   179 
       
   180 #endif
       
   181 
       
   182 // End of File