messagingappbase/bium/Inc/biou.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 1998 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:  biou  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #if !defined(__BIOU_H__)
       
    21 #define __BIOU_H__
       
    22 
       
    23 #include <mtmuibas.h>
       
    24 #include <bioscmds.h>           // for TBioProgress::EBiosProcessing
       
    25 #include <biodb.h>          // MBifChangeObserver, CBifObserver...
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS 
       
    27 #include <bifchangeobserver.h>
       
    28 #endif
       
    29 #include <MuiuMsgEditorLauncher.h> 
       
    30 
       
    31 // forward declarations
       
    32 class TBioData;
       
    33 class CTextResolver;
       
    34 class CMsvOperation;
       
    35 class CMtmStore;
       
    36 
       
    37 //////////////////////////////
       
    38 // CBioMtmUi - BIO MTM UI   //
       
    39 //////////////////////////////
       
    40 NONSHARABLE_CLASS(CBioMtmUi) : public CBaseMtmUi, public MBifChangeObserver
       
    41     {
       
    42 public:
       
    43     // --- Construction ---
       
    44     static CBioMtmUi* NewL(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll);
       
    45     //
       
    46     // --- Destruction ---
       
    47     virtual ~CBioMtmUi();
       
    48     //
       
    49     // --- Functions NOT dependent on the current context ---
       
    50     virtual CMsvOperation* CreateL(const TMsvEntry& aEntry, CMsvEntry& aParent, TRequestStatus& aStatus);// Context set to new entry
       
    51     //
       
    52     // --- Functions dependent on the current context ---
       
    53     virtual CMsvOperation* OpenL(TRequestStatus& aStatus); 
       
    54     virtual CMsvOperation* CloseL(TRequestStatus& aStatus);
       
    55     virtual CMsvOperation* EditL(TRequestStatus& aStatus);
       
    56     virtual CMsvOperation* ViewL(TRequestStatus& aStatus);
       
    57     //
       
    58     // --- Deletion ---
       
    59     // --- Deletes entries from the current context, which must be a folder or service of the relevant MTM ---
       
    60     virtual CMsvOperation* DeleteFromL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus);//Deletes selection from current context
       
    61     // --- Deletes service, which need not be the current context ---
       
    62     virtual CMsvOperation* DeleteServiceL(const TMsvEntry& aService, TRequestStatus& aStatus); // default implementation simply delegates to the server
       
    63     //
       
    64     // --- Message responding ---
       
    65     // --- Default implementation calls CBaseMtm::ReplyL() or ForwardL(), followed by EditL() ---
       
    66     // --- Takes ownership of the passed entry (which the context is switched to ---
       
    67     virtual CMsvOperation* ReplyL(TMsvId aDestination, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus);
       
    68     virtual CMsvOperation* ForwardL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
       
    69     //
       
    70     // --- Actions upon message selections ---
       
    71     // --- Selections must be in same folder and all of the correct MTM type ---
       
    72     // --- Context may change after calling these functions ---
       
    73     virtual CMsvOperation* OpenL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); 
       
    74     virtual CMsvOperation* CloseL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection);
       
    75     virtual CMsvOperation* EditL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection);
       
    76     virtual CMsvOperation* ViewL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection);
       
    77     virtual CMsvOperation* CancelL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection);
       
    78     //  
       
    79     // --- RTTI functions ---
       
    80     virtual TInt QueryCapability(TUid aCapability, TInt& aResponse);
       
    81     virtual CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TRequestStatus& aCompletionStatus, TDes8& aParameter);
       
    82     virtual void InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter);
       
    83     //  
       
    84     // --- These not relevant to BIO MTM - Leave with KErrNotSupported ---
       
    85     virtual CMsvOperation* CopyToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus);// Context should be MTM folder/service to copy to
       
    86     virtual CMsvOperation* MoveToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus);// Context should be MTM folder/service to move to
       
    87     virtual CMsvOperation* CopyFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus);// Context should be MTM folder/service to copy from
       
    88     virtual CMsvOperation* MoveFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus);// Context should be MTM folder/service to move from
       
    89     //
       
    90     // --- Interpret transfer progress
       
    91     virtual TInt GetProgress(const TDesC8& aProgress, TBuf<EProgressStringMaxLen>& aReturnString, TInt& aTotalEntryCount, TInt& aEntriesDone,
       
    92         TInt& aCurrentEntrySize, TInt& aCurrentBytesTrans) const;// Default implementation returns KErrNotSupported
       
    93     virtual TInt DisplayProgressSummary(const TDesC8& aProgress) const;// Used for display operation summary (usually completed operations). Default implementation returns KErrNotSupported.   
       
    94 
       
    95 protected: 
       
    96     // --- specific - Integrity checking ---
       
    97     virtual void CheckEntryL(const TMsvEntry& aEntry) const;
       
    98 
       
    99 protected: 
       
   100     // --- from CBaseMtmUi ---
       
   101     virtual void GetResourceFileName(TFileName& aFileName) const;
       
   102     
       
   103 protected:
       
   104     CBioMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll);
       
   105     virtual void ConstructL();
       
   106 
       
   107 protected: // from MBifChangeObserver
       
   108     virtual void HandleBifChangeL(TBifChangeEvent aEvent, TUid aBioId);
       
   109 
       
   110 protected: // new functions
       
   111 
       
   112     virtual void  ResetAndLoadBioDataL();
       
   113     virtual CMsvOperation* LaunchApplicationL(TRequestStatus& aStatus,TBool aReadOnly); 
       
   114     virtual TInt ProgressType(const TDesC8& aProgress) const;
       
   115     virtual TBool IsLocalProgress(TInt aProgressType) const;
       
   116     virtual TBool IsEngineProgress(TInt aProgressType) const;
       
   117 
       
   118     virtual CMsvOperation* ShowMessageInfoL(TRequestStatus& aCompletionStatus,TDes8& aParameter);
       
   119     virtual HBufC* ExtractTitleFromGMSBodyL(const CRichText& aBody, TInt aMaxLength);
       
   120 
       
   121     /**
       
   122      * Shows info note with qtn_mce_info_message_not_opened.
       
   123      * The note displaying is trapped, and the err code ignored.
       
   124      */
       
   125     virtual void ShowInvalidMsgNote() const;
       
   126 
       
   127     /**
       
   128      * Shows system error note. Uses CErrResolver for getting the text.
       
   129      * The note displaying is trapped, and the err code ignored.
       
   130      * @param aError The error code.
       
   131      */
       
   132     virtual void ShowSystemErrorNote(TInt aError) const;
       
   133 
       
   134     virtual HBufC* CreateFromTextLC(CMsvEntry& aEntry) const;
       
   135     
       
   136 protected:
       
   137     CArrayFixFlat<TBioData>* iBioData;
       
   138     CBifChangeObserver* iBifObserver;
       
   139     CTextResolver*  iErrorResolver;
       
   140     };
       
   141 
       
   142 
       
   143 
       
   144 /////////////////////////////////////////////////////////////////////////////////////
       
   145 // Operation encapsulating the parse operation and the launch application operation.
       
   146 /////////////////////////////////////////////////////////////////////////////////////
       
   147 
       
   148 struct TParseAndEditParams
       
   149     {
       
   150     TBool iLaunchApp;
       
   151     TBool iPreferEmbedded;
       
   152     TFileName iEditorFileName;
       
   153     TEditorParameters iEditorParams;        // Includes message Id.
       
   154     };
       
   155 
       
   156 
       
   157 class TBioUiProgress
       
   158     {
       
   159 public:
       
   160     enum TBioUiType
       
   161         {
       
   162         EBioMtmUiEditing=TBioProgress::EBiosProcessing+1,
       
   163         EBioMtmUiParseAndEdit
       
   164         };
       
   165 
       
   166     TInt    iType;
       
   167     TInt    iError;
       
   168     };
       
   169 
       
   170 // Internal class
       
   171 NONSHARABLE_CLASS(CParseAndEditOp) : public CMsvOperation
       
   172     {
       
   173 public:
       
   174     // --- Construction/destruction ---
       
   175     static CParseAndEditOp* NewL(CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus,
       
   176                                  const TParseAndEditParams& aParams);
       
   177     virtual ~CParseAndEditOp();
       
   178 
       
   179     // --- Setup and kick off operation ---
       
   180     void SetParseOpL(CMsvOperation* aParseOp);
       
   181 
       
   182     virtual const TDesC8& ProgressL();
       
   183     TRequestStatus& RequestStatus();
       
   184 
       
   185 protected:
       
   186     // --- from CActive ----
       
   187     virtual void DoCancel();
       
   188     virtual void RunL();
       
   189     virtual TInt RunError(TInt aError);
       
   190 
       
   191 private: // new functions
       
   192 
       
   193     // --- Construction---
       
   194     CParseAndEditOp(CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus,
       
   195                     const TParseAndEditParams& aParams);
       
   196     void ConstructL();
       
   197 
       
   198     void DoEditL();
       
   199     void CompleteObserver();
       
   200 
       
   201     /**
       
   202      * Sets the UNREAD and NEW properties of the entry to false.
       
   203      * @param The ID of the entry to be modified.
       
   204      */
       
   205     void SetEntryReadAndOldL(TMsvId aEntryId);
       
   206 
       
   207     /**
       
   208      * Deletes the parsed attachment from message store
       
   209      * @param The ID of the entry from which the attachment is to be deleted..
       
   210      */
       
   211     void DeleteMessageAttachmentL(TMsvId aEntryId);
       
   212 
       
   213 private:
       
   214     // Data
       
   215     enum TParseAndEditState { EStateIdle, EStateParsing, EStateEditing, EStateComplete };
       
   216     TParseAndEditState iState;
       
   217     TParseAndEditParams iParams;
       
   218     CMsvOperation* iOperation;
       
   219     TBioUiProgress iLocalProgress;  
       
   220     TPckgBuf<TBioUiProgress> iLocalProgressPckg;
       
   221     CMtmStore* iMtmStore;
       
   222     };
       
   223 
       
   224 
       
   225 #endif // __BIOU_H__