meetingrequest/mrcommon/inc/esmrhelper.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
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:  Definition for static helper methods
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ESMRHELPER_H
       
    19 #define ESMRHELPER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <msvstd.h>
       
    23 #include <calentry.h>
       
    24 
       
    25 class CCalAttendee;
       
    26 class CCalUser;
       
    27 class CMsvSession;
       
    28 
       
    29 /**
       
    30  *  Static helpers methods ES MR UI subsystem
       
    31  *
       
    32  */
       
    33 NONSHARABLE_CLASS(ESMRHelper)
       
    34     {
       
    35 public: // Data types
       
    36     /**
       
    37     * Enumeration for entry copy method
       
    38     */
       
    39     enum TCopyFields
       
    40         {
       
    41         ECopyFull,
       
    42         ECopyOrganizer,
       
    43         ECopySkeleton
       
    44         };
       
    45 
       
    46 public: // New functions
       
    47     /**
       
    48      * Creates a new copy of the given attendee.
       
    49      *
       
    50      * @param aSource
       
    51      * @return attendee, ownership is transferred to caller.
       
    52      */
       
    53     IMPORT_C static CCalAttendee* CopyAttendeeL(
       
    54             CCalAttendee& aSource );
       
    55 
       
    56     /**
       
    57      * Creates a new copy of the given attendee. Item is
       
    58      * left in the cleanup stack.
       
    59      *
       
    60      * @param aSource
       
    61      * @return attendee, ownership is transferred to caller.
       
    62      */
       
    63     IMPORT_C static CCalAttendee* CopyAttendeeLC(
       
    64             CCalAttendee& aSource );
       
    65 
       
    66     /**
       
    67      * Creates a new copy of the given cal user.
       
    68      *
       
    69      * @param aSource
       
    70      * @return user, ownership is transferred to caller.
       
    71      */
       
    72     IMPORT_C static CCalUser* CopyUserL(
       
    73             CCalUser& aSource );
       
    74 
       
    75     /**
       
    76      * Creates a new copy of the given cal user. Item is
       
    77      * left in the cleanup stack.
       
    78      *
       
    79      * @param aSource
       
    80      * @return user, ownership is transferred to caller.
       
    81      */
       
    82     IMPORT_C static CCalUser* CopyUserLC(
       
    83             CCalUser& aSource );
       
    84 
       
    85     /**
       
    86      * Creates a copy with given method type.
       
    87      * Start/end time and DTSTAMP are set even for a skeleton.
       
    88      * @param aEntry source entry
       
    89      * @param aCopyType specifies copied data
       
    90      * @return instantiated entry, ownership transferred to caller
       
    91      */
       
    92     IMPORT_C static CCalEntry* CopyEntryL(
       
    93             const CCalEntry& aEntry,
       
    94             CCalEntry::TMethod aMethod,
       
    95             TCopyFields aCopyType );
       
    96 
       
    97     /**
       
    98      * Creates a copy with given method type.
       
    99      * Start/end time and DTSTAMP are set even for a skeleton.
       
   100      * Copied entry is left in the cleanup stack.
       
   101      * @param aEntry source entry
       
   102      * @param aCopyType specifies copied data
       
   103      * @return instantiated entry, ownership transferred to caller
       
   104      */
       
   105     IMPORT_C static CCalEntry* CopyEntryLC(
       
   106             const CCalEntry& aEntry,
       
   107             CCalEntry::TMethod aMethod,
       
   108             TCopyFields aCopyType );
       
   109 
       
   110     /**
       
   111      * Copies entry fields according to the copy type specification.
       
   112      * Unlike CCalEntry::CopyFromL() this function never copies
       
   113      * the entry method property.
       
   114      * @param aSource source for copying
       
   115      * @param aTarget target for copying
       
   116      * @param aCopyType specifies what data to copy
       
   117      */
       
   118     IMPORT_C static void CopyFieldsL(
       
   119             const CCalEntry& aSource,
       
   120             CCalEntry& aTarget,
       
   121             TCopyFields aCopyType );
       
   122 
       
   123     /**
       
   124      * Returns TPtrC to all/part of the aAddress parameter
       
   125      * so that possible "mailto:" or "MAILTO:" prefix is 
       
   126      * stripped out.
       
   127      *
       
   128      * @param aAddress address which might contain the prefix
       
   129      * @return TPtrC which represents only the address
       
   130      */
       
   131     IMPORT_C static TPtrC AddressWithoutMailtoPrefix(
       
   132             const TDesC& aAddress );
       
   133 
       
   134     /**
       
   135      * Parses drive name of dll(eg. "c:") and sets it to
       
   136      * aDriveName parameter.
       
   137      *
       
   138      * @param aDriveName TFileName where parsed drive letter
       
   139      * shall be set.
       
   140      */
       
   141     IMPORT_C static void GetCorrectDllDriveL(
       
   142             TFileName& aDriveName );
       
   143 
       
   144     /**
       
   145      * Loads resource file into CONE environment.
       
   146      * @param aResourceFile Resource file name.
       
   147      * @param aResourcePath Resource file path.
       
   148      * @return Resource file offset.
       
   149      */
       
   150     IMPORT_C static TInt LoadResourceL(
       
   151             const TDesC& aResourceFile,
       
   152             const TDesC& aResourcePath );
       
   153     /**
       
   154      * Resolves corresponding SMTP service for received MTM
       
   155      * @param aRelatedService Related service
       
   156      * @param aMsvSession Reference to MSV session.
       
   157      * @return TMsvId for sending service.
       
   158      */
       
   159     IMPORT_C static TMsvId CorrespondingSmtpServiceL(
       
   160             TMsvId aRelatedService,
       
   161             CMsvSession& aMsvSession );
       
   162 
       
   163     /**
       
   164      * Populates empty fields of a child entry with data from the
       
   165      * parent entry.
       
   166      * @param aChild Child (modifying) entry to be populated .
       
   167      * @param Parent (originating) entry
       
   168      */
       
   169     IMPORT_C static void PopulateChildFromParentL (
       
   170             CCalEntry &aChild,
       
   171             const CCalEntry &aParent);
       
   172 
       
   173      /**
       
   174      * Locates the calentry policy resource file.
       
   175      *
       
   176      * @param aResource Resourcefile to be located.
       
   177      * @param aPath Path from which file is searched
       
   178      * @param aResourceFile On return contains the resource file name.
       
   179      * @param aFs File server session reference. Ownership is not transfered.
       
   180      * @return KErrNone on success, otherwise system wide error code.
       
   181      */
       
   182     IMPORT_C static TInt LocateResourceFile(
       
   183             const TDesC& aResource,
       
   184             const TDesC& aPath,
       
   185             TFileName &aResourceFile,
       
   186             RFs* aFs = NULL );
       
   187     
       
   188     //<cmail> getting temporary file name is not hard coded
       
   189     /**
       
   190     * Creates and append process'es private directory to begining of file.
       
   191     * It also appends two back slashes, so aFileName should not contain any
       
   192     * backslashes in the begining.
       
   193     *
       
   194     * @param aFileName private directory is appended to this file name
       
   195     * @return error code
       
   196     */
       
   197     IMPORT_C static TInt CreateAndAppendPrivateDirToFileName(TFileName& aFileName);
       
   198     //</cmail>
       
   199     
       
   200     };
       
   201 
       
   202 #endif      // ESMRHELPER_H