meetingui/inc/MREntryConsultant.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2005 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:   Static helper methods for analyzing entries
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MRENTRYCONSULTANT_H
       
    22 #define MRENTRYCONSULTANT_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <MAgnEntryUi.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCalEntry;
       
    30 class CCalUser;
       
    31 class CCalAttendee;
       
    32 class CMRUtilsInternal;
       
    33 class CMRMailboxUtils;
       
    34 
       
    35 
       
    36 /**
       
    37 *  Static helpers methods for MR Viewers for analyzing entry
       
    38 *  content and properties.
       
    39 *
       
    40 *  @since Series S60 3.0
       
    41 */
       
    42 class MREntryConsultant
       
    43     {        	    
       
    44     public: // New functions
       
    45 
       
    46         /**
       
    47         * Tells the mailbox id to use for sending a request or a response.
       
    48         * From mail application we may only respond, and in that case we
       
    49         * use the incoming mailbox. From other places we must use the
       
    50         * default MR mailbox setting.
       
    51         * @param aInParams input parameters for AgnEntryUi
       
    52         * @param aUtils reference to MR Utils
       
    53         * @return mailbox id, KMsvNullIndexEntryId if not available
       
    54         */
       
    55         static TMsvId SendingMailBoxL(
       
    56             const MAgnEntryUi::TAgnEntryUiInParams& aInParams,
       
    57             CMRMailboxUtils& aUtils );
       
    58             
       
    59         /**
       
    60         * Tells whether the entry belongs to a repeating meeting.
       
    61         * The definition of a repeating meeting is not that there must be
       
    62         * multiple instances, but that repeating properties exist (e.g. RRule).
       
    63         */
       
    64         static TBool IsRepeatingMeetingL( const CCalEntry& aEntry );
       
    65     
       
    66         /**
       
    67         * Tests whether given entry is an originating entry or a modifying
       
    68         * entry.
       
    69         * @param aEntry to evaluate
       
    70         * @return ETrue if modifying entry, EFalse otherwise
       
    71         */
       
    72         static TBool IsModifyingEntryL( const CCalEntry& aEntry );
       
    73         
       
    74         /**
       
    75         * Does entry need saving, i.e. is it new or does it differ from the one 
       
    76         * in the db?
       
    77         * TODO: Symbian API does not notice minor changes (e.g. description,
       
    78         * location). If taking this method in use consider that problem.
       
    79         * @param aEntry
       
    80         * @param aUtils
       
    81         * @return ETrue if needs saving
       
    82         */
       
    83         static TBool IsEditedL( const CCalEntry& aEntry,
       
    84                                 CMRUtilsInternal& aUtils );
       
    85         
       
    86         /**
       
    87         * Has this entry been sent at all yet? It is sent if entry's
       
    88         * status is not ENullStatus.
       
    89         * @param aEntry
       
    90         * @return ETrue if request has been sent
       
    91         */
       
    92         static TBool IsSentL( const CCalEntry& aEntry );
       
    93         
       
    94         /**
       
    95         * Has this particular entry with it's latest saved content been sent?
       
    96         * This is determined from the DTSTAMP value which is null until
       
    97         * up to date entry is sent.
       
    98         * @param aEntry       
       
    99         * @return ETrue if entry has been sent
       
   100         */
       
   101         static TBool IsLatestSavedSentL( const CCalEntry& aEntry );
       
   102            
       
   103         /**
       
   104         * Checks if either entire meeting is cancelled, or if entry is
       
   105         * cancellation for this particular attendee.
       
   106         * @param aEntry
       
   107         * @return ETrue if meeting cancelled from user's point of view
       
   108         */
       
   109         static TBool IsCancelledL( const CCalEntry& aEntry,
       
   110                                    CMRMailboxUtils& aUtils );
       
   111                                    
       
   112         /**
       
   113         * Checks whether entry with the same UID and RECURRENCE-ID exists in
       
   114         * database. In strict mode also SEQUENCE and DTSTAMP are evaluated.
       
   115         * @param aEntry 
       
   116         * @param aUtils
       
   117         * @param aStrictMode to be used when entries must be identical
       
   118         * @return ETrue if database entry exists
       
   119         */   
       
   120         static TBool ExistsInDbL( const CCalEntry& aEntry,
       
   121                                   CMRUtilsInternal& aUtils,
       
   122                                   TBool aStrictMode = EFalse );
       
   123 
       
   124         /**
       
   125         * Checks whether entry is out of date or not.
       
   126         * @param aEntry entry to check
       
   127         * @return ETrue if entry is outdated
       
   128         */                                   
       
   129         static TBool IsEntryOutOfDateL( const CCalEntry& aEntry );
       
   130         
       
   131         /**
       
   132         * Returns phone owner's address, KNullDesC if not found.
       
   133         * @param aEntry entry to evaluate
       
   134         * @param aUtils utility reference        
       
   135         * @return address
       
   136         */                                   
       
   137         static const TDesC& PhoneOwnerAddrL( const CCalEntry& aEntry,
       
   138                                              CMRMailboxUtils& aUtils );
       
   139                                              
       
   140         /**
       
   141         * Searches for the given attendee in aEntry. This is usable e.g.
       
   142         * in case of response, when compare and update attendee in
       
   143         * response and request. Matching is done based on e-mail address.
       
   144         * @param aAttendee reference attendee to be found
       
   145         * @aEntry entry containing possibly multiple attendees
       
   146         * @return matching attendee or NULL, ownership is not transferred
       
   147         */
       
   148         static CCalAttendee* EqualAttendeeL( const CCalAttendee& aAttendee,
       
   149                                              const CCalEntry& aEntry );
       
   150                                              
       
   151         /**
       
   152         * Method which checks if start and end time span multiple days.
       
   153         * @param aEntry
       
   154         * @return ETrue if spans multiple days
       
   155         */
       
   156         static TBool SpansManyDaysL( const TCalTime& aStartTime,
       
   157                                      const TCalTime& aEndTime );
       
   158         
       
   159     private:
       
   160     
       
   161         CMRMailboxUtils* iMailboxUtils;    
       
   162     };
       
   163 
       
   164 #endif      // MRENTRYCONSULTANT_H
       
   165 
       
   166 // End of File
       
   167