wvuing/wvuiave/AppSrc/CCARecordedChatsArray.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Array wrapper for recorded chats view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCARECORDEDCHATSARRAY_H__
       
    21 #define CCARECORDEDCHATSARRAY_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "BAMDESCA.H"
       
    26 #include "MCARecordedChatProvider.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MCALoggerMessageHeader;
       
    30 class RWriteStream;
       
    31 class MCARecordedChatsArrayPC;
       
    32 class MCARecordedChatsPC;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  Recorded chats header array wrapper
       
    38 *  Wraps real array handling to MDesCArray protocol
       
    39 *
       
    40 *  @chatng.exe
       
    41 *  @since 3.2
       
    42 */
       
    43 class CCARecordedChatsArray :   public CBase,
       
    44             public MDesCArray,
       
    45             public MCARecordedChatProvider
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48 
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         * @param aRecordedChatsPC Reference to Recorded Chats process component
       
    52         * @param aRecordedChatsArrayPC Reference to Recorded Chats Array process component
       
    53         */
       
    54         static CCARecordedChatsArray* NewL( MCARecordedChatsPC& aRecordedChatsPC,
       
    55                                             MCARecordedChatsArrayPC& aRecordedChatsArrayPC );
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         virtual ~CCARecordedChatsArray();
       
    61 
       
    62     public: // New Methods
       
    63 
       
    64         /**
       
    65         * Recorded chat index by name.
       
    66         * @since S60 v3.2
       
    67         * @param aName Name of recorded chat.
       
    68         * @return Index of chat or KErrNotFound if
       
    69         *         it was not found.
       
    70         */
       
    71         TInt Index( const TDesC& aName ) const;
       
    72 
       
    73 
       
    74 
       
    75         /**
       
    76          * Returns the logger message header from given index
       
    77          * @param aIndex Item index
       
    78          * @return Logger message header
       
    79          */
       
    80         MCALoggerMessageHeader& LoggerMessageHeader( TInt aIndex ) const;
       
    81 
       
    82         /**
       
    83          *	Return name for history file found from index
       
    84          *  @param aIndex index to search
       
    85          */
       
    86         const TDesC& Name( TInt aIndex ) const;
       
    87 
       
    88         /**
       
    89          *	Delete history files. If there is marked items those are deleted.
       
    90          *	Otherwise item which index is given is deleted.
       
    91          *  @param aIndex Item index
       
    92          *  @return ETrue, if deletion is ok to start, EFalse if not.
       
    93          */
       
    94         TBool DeleteHistoryFilesL( TInt aIndex );
       
    95 
       
    96         /**
       
    97          *	Delete history file from local delete index
       
    98          *  @return ETrue, there is items to delete,
       
    99          *          EFalse if deletion is ready.
       
   100          */
       
   101         TBool DeleteHistoryFileL();
       
   102 
       
   103         /**
       
   104          *	Is current chat ordered to be deleted
       
   105          *  @return ETrue, if is, EFalse if not.
       
   106          */
       
   107         TBool CurrentChatDeleteStatus();
       
   108 
       
   109         /**
       
   110          *	Set curren item index. This must be set before messages are opened
       
   111          *  to Recorded Chats view.
       
   112          *  @param aIndex Item index
       
   113          */
       
   114         void SetCurrentItemIndex( TInt aIndex );
       
   115 
       
   116         /**
       
   117          *	Method is used to launch MTM editor with given targetUid
       
   118          *  @param aTargetUid id for MTM editor to be launched.
       
   119          *  @param aIndex Message index which to send.
       
   120          */
       
   121         //Code Scanner warning to be ignored
       
   122         TInt SendMTML( TInt aIndex, TUid aTargetUid = KNullUid );
       
   123 
       
   124         /**
       
   125          *	Progress count for progress of deletion.
       
   126          *  @return const reference to marked count for progress of deletion.
       
   127          */
       
   128         TInt ProgressCount() const;
       
   129 
       
   130         /**
       
   131          * Prepares array for sending MTMs.
       
   132          */
       
   133         void PrepareArrayForSendingMtmL();
       
   134 
       
   135 
       
   136         /**
       
   137          *	Return current item index
       
   138          *  @return current item index
       
   139          */
       
   140         TInt CurrentItemIndex() const;
       
   141 
       
   142         /**
       
   143          *  Initialize/unitialize selected items array pointer
       
   144          *  @param aArray Pointer to selected items array.
       
   145          */
       
   146         void SetSelectedItems( const CArrayFix< TInt >* aArray );
       
   147 
       
   148     public: // Functions from base classes (MDesCArray)
       
   149 
       
   150         /**
       
   151          *  Count of items in array.
       
   152          *  @return the number of descriptor elements in
       
   153          *  a descriptor array.
       
   154          */
       
   155         TInt MdcaCount() const;
       
   156 
       
   157         /**
       
   158          * Indexes into a descriptor array.
       
   159          * @param aIndex The position of the descriptor element within a
       
   160          * descriptor array
       
   161          * @return A 16 bit non-modifiable pointer descriptor representing
       
   162          * the descriptor element located at position aIndex within a
       
   163          * descriptor array.
       
   164          */
       
   165         TPtrC16 MdcaPoint( TInt aIndex ) const;
       
   166 
       
   167     public: //Methods from MCARecordedChatProvider
       
   168 
       
   169         /**
       
   170          *  Recorded chat name.
       
   171          *  @return name of recorded chat.
       
   172          */
       
   173         const TDesC& RecordedChatName() const;
       
   174 
       
   175         /**
       
   176          *  End time of recorded chat.
       
   177          *	@return end time of recorded chat.
       
   178          */
       
   179         TTime RecordedEndDate() const;
       
   180 
       
   181         /**
       
   182          *  Set current chat to be deleted.
       
   183          *  @return ETrue if deletion is ok to continue, EFalse if not.
       
   184          */
       
   185         TBool DeleteChatL();
       
   186 
       
   187         /**
       
   188          *	Send current chat via MTM
       
   189          *  @param aTargetUid id of MTM to use for sending.
       
   190          */
       
   191         void SendChatViaMTML( TUid aTargetUid = KNullUid );
       
   192 
       
   193         /**
       
   194          * @see MCARecordedChatProvider
       
   195          */
       
   196         void DynInitSendMenuL( CEikMenuPane& aMenuPane );
       
   197 
       
   198         /**
       
   199          * @see MCARecordedChatProvider
       
   200          */
       
   201         void DeleteRecordedChatContainerL();
       
   202 
       
   203     private:
       
   204 
       
   205         /**
       
   206          * Show confirmation note for deletion
       
   207          * @param aIndex Index of current chat to be deleted
       
   208          * @return ETrue if deletion is ok, EFalse if not.
       
   209          */
       
   210         TBool ShowConfirmationNoteL( TInt aIndex );
       
   211 
       
   212         /**
       
   213          * Check filename for MTM messages and correct
       
   214          * it to unique if it is not.
       
   215          * @param aFilename Proposed filename and corrected after checking.
       
   216          * @param aArray Array of already existing filenames.
       
   217          */
       
   218         void CheckAndCorrectMtmFilename( TFileName& aFilename,
       
   219                                          MDesCArray& aArray );
       
   220 
       
   221         /**
       
   222          *  Initialize array for deletion. Sort is from back to start.
       
   223          */
       
   224         void InitDeleteArrayL();
       
   225 
       
   226     private:
       
   227 
       
   228         /**
       
   229          * C++ default constructor.
       
   230          * @param aRecordedChatsPC Reference to Recorded Chats process component
       
   231          * @param aRecordedChatsArrayPC Reference to Recorded Chats Array process component
       
   232          */
       
   233 
       
   234         CCARecordedChatsArray( MCARecordedChatsPC& aRecordedChatsPC,
       
   235                                MCARecordedChatsArrayPC& aRecordedChatsArrayPC );
       
   236 
       
   237         /**
       
   238          * By default Symbian OS constructor is private.
       
   239          */
       
   240         void ConstructL();
       
   241 
       
   242     private:    // Data
       
   243 
       
   244         // Current chat deletion or not
       
   245         TBool iDeleteCurrentChat;
       
   246 
       
   247         // Read access to recorded chats PC.
       
   248         MCARecordedChatsPC& iRecordedChatsPC;
       
   249 
       
   250         // Read access to recorded chats array PC.
       
   251         MCARecordedChatsArrayPC& iRecordedChatsArrayPC;
       
   252     };
       
   253 
       
   254 #endif      // CCARECORDEDCHATSARRAY_H__
       
   255 
       
   256 // End of File