meetingrequest/mrentry/inc/cesmrfsmailboxutils.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  ESMR FS mailbox utilities definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMRFSMAILBOXUTILS_H
       
    19 #define CESMRFSMAILBOXUTILS_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <cmrmailboxutils.h>
       
    23 #include "CFSMailCommon.h"
       
    24 #include "esmrdef.h"
       
    25 
       
    26 class CFSMailClient;
       
    27 class CFSMailMessage;
       
    28 class CFSMailBox;
       
    29 class CCalUser;
       
    30 
       
    31 
       
    32 /**
       
    33  * Utility class for FS mailbox
       
    34  */
       
    35 NONSHARABLE_CLASS( CESMRFsMailboxUtils ): public CBase
       
    36     {
       
    37 
       
    38 public: // Constructors and destructors
       
    39 
       
    40     /**
       
    41     * Constructs CESMRFsMailboxUtils object.
       
    42     *
       
    43     * @param aMailboxUtils Reference to S60 mailbox utils
       
    44     * @return instantiated object, ownership transferred
       
    45     */
       
    46     static CESMRFsMailboxUtils* NewL(
       
    47             CMRMailboxUtils& aMailboxUtils );
       
    48 
       
    49     /**
       
    50     * C++ Destructor.
       
    51     */
       
    52     ~CESMRFsMailboxUtils();
       
    53 
       
    54 public: // New functions
       
    55 
       
    56     /**
       
    57     * If phone owner field hasn't been set so far, this method compares
       
    58     * organizer field to the mailboxes in the device, and if no match
       
    59     * was found compares each attendee to the mailboxes. If match was found,
       
    60     * phone owner field is set, otherwise KErrNotFound is returned.
       
    61     * If aPrimaryBox is given, then that is used in matching before any
       
    62     * other mailbox. If not given, then default MR mailbox will have
       
    63     * the highest presedence followed by other MR-capable mailboxes.
       
    64     *
       
    65     * @param aCalEntry entry to modify
       
    66     * @param aPrimaryBox primary mailbox for matching, if applicable
       
    67     * @return KErrNone or a system wide error code
       
    68     */
       
    69     TInt SetPhoneOwnerL(
       
    70         CCalEntry& aCalEntry,
       
    71         TMsvId aPrimaryBox = KMsvNullIndexEntryId );
       
    72 
       
    73     /**
       
    74     * If phone owner field hasn't been set so far, this method compares
       
    75     * mailboxowner's email address to organizer field and if no match
       
    76     * was found compares each attendee to the mailboxowner's email address. 
       
    77     * If match was found, phone owner field is set, otherwise KErrNotFound 
       
    78     * is returned.
       
    79     *
       
    80     * @param aCalEntry entry to modify
       
    81     * @param aPrimaryBox primary mailbox for matching, if applicable
       
    82     * @return KErrNone or a system wide error code
       
    83     */
       
    84     TInt SetPhoneOwnerL(
       
    85         CCalEntry& aCalEntry,
       
    86         CFSMailClient& aMailClient,
       
    87         CFSMailMessage& aMailMessage );    
       
    88     
       
    89     /**
       
    90      * Resolves the plugin to be used to current calendar entry.
       
    91      * Method retrieves phone owner from calendar entry and loops all
       
    92      * FS Email mailboxes. 
       
    93      * @param aEntry Reference to calendar entry.
       
    94      * @return Plugin ID for FS Email mailbox
       
    95      */
       
    96     TESMRMailPlugin FSEmailPluginForEntryL( const CCalEntry& aEntry );
       
    97 
       
    98     /**
       
    99      * Resolves the mail box for current calendar entry.
       
   100      * Method retrieves phone owner from calendar entry and loops all
       
   101      * FS Email mailboxes. 
       
   102      * @param aEntry Reference to calendar entry.
       
   103      * @return ID of the FS Email mailbox
       
   104      */
       
   105     TFSMailMsgId FSEmailMailBoxForEntryL( const CCalEntry& aEntry );
       
   106     
       
   107 private: // Implementation
       
   108     CESMRFsMailboxUtils(
       
   109             CMRMailboxUtils& aMailboxUtils );
       
   110     void ConstructL();
       
   111     CCalUser* PhoneOwnerL(
       
   112             const CCalEntry& aCalEntry,
       
   113             const RPointerArray<CFSMailBox>& aMailBoxes,
       
   114             TInt& aMatchIndex );
       
   115     TBool IsPhoneOwnerL(
       
   116             const CCalUser& aUser,
       
   117             const RPointerArray<CFSMailBox>& aMailBoxes,
       
   118             TInt& aMatchIndex );
       
   119     
       
   120     CFSMailClient& MailClientL();
       
   121 
       
   122 private: // Data
       
   123     /// Ref: Reference to S60 mailbox utilities
       
   124     CMRMailboxUtils& iMRMailboxUtils;
       
   125     /// Own: Mail client object
       
   126     CFSMailClient* iMailClient;
       
   127     };
       
   128 
       
   129 #endif // CESMRFSMAILBOXUTILS_H
       
   130 
       
   131 // EOF
       
   132