meetingrequest/mrcommon/inc/esmrhelper.h
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 #define ESMRHELPER_H
    19 #define ESMRHELPER_H
    20 
    20 
    21 #include <e32base.h>
    21 #include <e32base.h>
    22 #include <msvstd.h>
    22 #include <msvstd.h>
    23 #include <calentry.h>
    23 #include <calentry.h>
       
    24 
       
    25 #include "esmrdef.h"
    24 
    26 
    25 class CCalAttendee;
    27 class CCalAttendee;
    26 class CCalUser;
    28 class CCalUser;
    27 class CMsvSession;
    29 class CMsvSession;
    28 
    30 
    90      * @return instantiated entry, ownership transferred to caller
    92      * @return instantiated entry, ownership transferred to caller
    91      */
    93      */
    92     IMPORT_C static CCalEntry* CopyEntryL(
    94     IMPORT_C static CCalEntry* CopyEntryL(
    93             const CCalEntry& aEntry,
    95             const CCalEntry& aEntry,
    94             CCalEntry::TMethod aMethod,
    96             CCalEntry::TMethod aMethod,
    95             TCopyFields aCopyType );
    97             TCopyFields aCopyType,
       
    98             TESMRCalendarEventType aEntryType = EESMREventTypeNone );
    96 
    99 
    97     /**
   100     /**
    98      * Creates a copy with given method type.
   101      * Creates a copy with given method type.
    99      * Start/end time and DTSTAMP are set even for a skeleton.
   102      * Start/end time and DTSTAMP are set even for a skeleton.
   100      * Copied entry is left in the cleanup stack.
   103      * Copied entry is left in the cleanup stack.
   103      * @return instantiated entry, ownership transferred to caller
   106      * @return instantiated entry, ownership transferred to caller
   104      */
   107      */
   105     IMPORT_C static CCalEntry* CopyEntryLC(
   108     IMPORT_C static CCalEntry* CopyEntryLC(
   106             const CCalEntry& aEntry,
   109             const CCalEntry& aEntry,
   107             CCalEntry::TMethod aMethod,
   110             CCalEntry::TMethod aMethod,
   108             TCopyFields aCopyType );
   111             TCopyFields aCopyType,
       
   112             TESMRCalendarEventType aEntryType = EESMREventTypeNone );
   109 
   113 
   110     /**
   114     /**
   111      * Copies entry fields according to the copy type specification.
   115      * Copies entry fields according to the copy type specification.
   112      * Unlike CCalEntry::CopyFromL() this function never copies
   116      * Unlike CCalEntry::CopyFromL() this function never copies
   113      * the entry method property.
   117      * the entry method property.
   120             CCalEntry& aTarget,
   124             CCalEntry& aTarget,
   121             TCopyFields aCopyType );
   125             TCopyFields aCopyType );
   122 
   126 
   123     /**
   127     /**
   124      * Returns TPtrC to all/part of the aAddress parameter
   128      * Returns TPtrC to all/part of the aAddress parameter
   125      * so that possible "mailto:" or "MAILTO:" prefix is 
   129      * so that possible "mailto:" or "MAILTO:" prefix is
   126      * stripped out.
   130      * stripped out.
   127      *
   131      *
   128      * @param aAddress address which might contain the prefix
   132      * @param aAddress address which might contain the prefix
   129      * @return TPtrC which represents only the address
   133      * @return TPtrC which represents only the address
   130      */
   134      */
   182     IMPORT_C static TInt LocateResourceFile(
   186     IMPORT_C static TInt LocateResourceFile(
   183             const TDesC& aResource,
   187             const TDesC& aResource,
   184             const TDesC& aPath,
   188             const TDesC& aPath,
   185             TFileName &aResourceFile,
   189             TFileName &aResourceFile,
   186             RFs* aFs = NULL );
   190             RFs* aFs = NULL );
   187     
   191 
   188     //<cmail> getting temporary file name is not hard coded
   192     //<cmail> getting temporary file name is not hard coded
   189     /**
   193     /**
   190     * Creates and append process'es private directory to begining of file.
   194     * Creates and appends process' private directory to beginning of file.
   191     * It also appends two back slashes, so aFileName should not contain any
   195     * It also appends two back slashes, so aFileName should not contain any
   192     * backslashes in the begining.
   196     * backslashes in the begining.
   193     *
   197     *
   194     * @param aFileName private directory is appended to this file name
   198     * @param aFileName private directory is appended to this file name
   195     * @return error code
   199     * @return error code
   196     */
   200     */
   197     IMPORT_C static TInt CreateAndAppendPrivateDirToFileName(TFileName& aFileName);
   201     IMPORT_C static TInt CreateAndAppendPrivateDirToFileName(
       
   202             TFileName& aFileName);
   198     //</cmail>
   203     //</cmail>
   199     
   204 
       
   205     /**
       
   206     * Creates and appends system private directory to beginning of file.
       
   207     * It also appends two back slashes, so aFileName should not contain any
       
   208     * backslashes in the begining.
       
   209     *
       
   210     * @param aFileName Others directory is appended to this file name
       
   211     * @return error code
       
   212     */
       
   213     IMPORT_C static TInt CreateAndAppendOthersDirToFileName(
       
   214             TFileName& aFileName);
       
   215 
       
   216 private:
       
   217     /**
       
   218      * Enumeration for entry type switching
       
   219      */
       
   220 
       
   221     enum TESMRSwitchEventType
       
   222         {
       
   223         EMRSwitchUnknown = -1,
       
   224         EMRSwitchMRToMeeting = 0,
       
   225         EMRSwitchMRToMemo,
       
   226         EMRSwitchMRToAnniversary,
       
   227         EMRSwitchMRToTodo,
       
   228 
       
   229         EMRSwitchMeetingToMR,
       
   230         EMRSwitchMeetingToMemo,
       
   231         EMRSwitchMeetingToAnniversary,
       
   232         EMRSwitchMeetingToTodo,
       
   233 
       
   234         EMRSwitchMemoToMR,
       
   235         EMRSwitchMemoToMeeting,
       
   236         EMRSwitchMemoToAnniversary,
       
   237         EMRSwitchMemoToTodo,
       
   238 
       
   239         EMRSwitchAnniversaryToMR,
       
   240         EMRSwitchAnniversaryToMeeting,
       
   241         EMRSwitchAnniversaryToMemo,
       
   242         EMRSwitchAnniversaryToTodo,
       
   243 
       
   244         EMRSwitchTodoToMR,
       
   245         EMRSwitchTodoToMeeting,
       
   246         EMRSwitchTodoToMemo,
       
   247         EMRSwitchTodoToAnniversary
       
   248         };
       
   249 
       
   250 private: // implementation
       
   251 
       
   252     static CCalEntry* CopyEntryAndSwitchTypeL(
       
   253             const CCalEntry& aSourceEntry,
       
   254             TESMRCalendarEventType aTargetType );
       
   255 
       
   256     static TESMRSwitchEventType ResolveSwitchType(
       
   257             TESMRCalendarEventType aSourceType,
       
   258             TESMRCalendarEventType aTargetType );
       
   259 
       
   260     // This handles all entry type changes to Memo
       
   261     static CCalEntry* SwitchToMemoL( const CCalEntry& aSourceEntry );
       
   262     // This handles all entry type changes to Anniversary
       
   263     static CCalEntry* SwitchToAnniversaryL( const CCalEntry& aSourceEntry );
       
   264     // This handles all entry type changes to To-do
       
   265     static CCalEntry* SwitchToTodoL( const CCalEntry& aSourceEntry );
       
   266     // This handles all entry type changes to Meeting
       
   267     static CCalEntry* SwitchToMeetingL( const CCalEntry& aSourceEntry );
       
   268     // This handles all entry type changes to Meeting request
       
   269     static CCalEntry* SwitchToMRL( const CCalEntry& aSourceEntry );
       
   270 
       
   271     // Helper functions
       
   272     static CCalEntry* CreateEntryL(
       
   273             CCalEntry::TType aType,
       
   274             const TDesC8& aUid,
       
   275             CCalEntry::TMethod aMethod,
       
   276             CalCommon::TRecurrenceRange aRange );
       
   277     static void SetMeetingTimeL(
       
   278             CCalEntry& aTargetEntry,
       
   279             const CCalEntry& aSourceEntry );
       
   280     static void SetDefaultAlarmForMeetingL(
       
   281             CCalEntry& aTargetEntry );
       
   282     static void AddOrganizerL( CCalEntry& aTargetEntry );
   200     };
   283     };
   201 
   284 
   202 #endif      // ESMRHELPER_H
   285 #endif      // ESMRHELPER_H