calendarui/calenaiwprovider/inc/calenaiwprovider.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2  * Copyright (c) 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 : Header file for calenaiwprovider class.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __CALENAIWPROVIDER_H__
       
    19 #define __CALENAIWPROVIDER_H__
       
    20 
       
    21 // System includes
       
    22 #include <AiwServiceIfMenu.h>
       
    23 #include <calprogresscallback.h>
       
    24 
       
    25 // User includes
       
    26 #include "calentry.h"
       
    27 
       
    28 // Forward declarations.
       
    29 class CCalSession;
       
    30 class CCalEntryView;
       
    31 class CCalenaiwprovidertest;
       
    32 class CCalenInterimUtils2;
       
    33 
       
    34 // Class declaration
       
    35 /**
       
    36  * This class implements the CAiwServiceIfMenu. Adds a menu item to the menu 
       
    37  * pane of the client, which saves a given calendar entry to the selected 
       
    38  * calendar database.
       
    39  * 
       
    40  * @lib calenaiwprovider.dll
       
    41  * @since S60 v5.2.
       
    42  */
       
    43 class CCalenAiwProvider : public CAiwServiceIfMenu, 
       
    44                           public MCalProgressCallBack
       
    45     {
       
    46     public:
       
    47         /**
       
    48          * @brief Create a CCalenAiwProvider object. Performs the wrapper for
       
    49          * phase of 2-phase construction.
       
    50          * 
       
    51          */
       
    52         static CCalenAiwProvider* NewL();
       
    53 
       
    54         /**
       
    55          * @brief Create a CCalenAiwProvider object. Performs the wrapper for
       
    56          * phase of 2-phase construction.Keep the object pointer in cleanup stack.
       
    57          */
       
    58         static CCalenAiwProvider* NewLC();
       
    59 
       
    60         /**
       
    61          * 
       
    62          */
       
    63         ~CCalenAiwProvider();
       
    64 
       
    65     public:
       
    66         /**
       
    67          * From CAiwServiceIfBase.
       
    68          * 
       
    69          * Called by the AIW framework to initialise provider with necessary 
       
    70          * information from the Service Handler. This method is called when the 
       
    71          * consumer makes the attach operation.
       
    72          *
       
    73          * @param aFrameworkCallback Framework provided callback for provider to 
       
    74          *                          send events to framework.
       
    75          * @param aInterest List of criteria items which invoked the provider.
       
    76          */
       
    77         void InitialiseL( MAiwNotifyCallback& aFrameworkCallback, 
       
    78                 const RCriteriaArray& aInterest );
       
    79 
       
    80         /**
       
    81          * From CAiwServiceIfBase.
       
    82          * 
       
    83          * Executes generic service commands included in criteria.
       
    84          *
       
    85          * @param aCmdId Command to be executed.
       
    86          * @param aInParamList Input parameters, can be an empty list.
       
    87          * @param aOutParamList Output parameters, can be an empty list.
       
    88          * @param aCmdOptions Options for command, see KAiwOpt* in AiwCommon.hrh.
       
    89          * @param aCallback Callback for asynchronous command handling, 
       
    90          *                  parameter checking, etc.
       
    91          * @leave KErrArgument Callback is missing when required.
       
    92          * @leave KErrNotSupported No provider supports service.
       
    93          */
       
    94         void HandleServiceCmdL( const TInt& aCmdId, 
       
    95                 const CAiwGenericParamList& aInParamList, 
       
    96                 CAiwGenericParamList& aOutParamList, 
       
    97                 TUint aCmdOptions = 0, 
       
    98                 const MAiwNotifyCallback* aCallback = NULL );
       
    99 
       
   100         /**
       
   101          * From CAiwServiceIfMenu.
       
   102          * 
       
   103          * Provider should implement this method to initialise a menu pane by 
       
   104          * adding provider specific menu items. The AIW framework gives the 
       
   105          * parameters to be used in the addition process.
       
   106          *
       
   107          * @param aMenuPane Menu pane handle.
       
   108          * @param aIndex The position of the item where to add menu items.
       
   109          * @param aCascadeId ID of cascade menu item.
       
   110          * @param aInParamList Input list for provider's parameter checking.
       
   111          */
       
   112         void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, 
       
   113                 TInt aIndex, 
       
   114                 TInt aCascadeId, 
       
   115                 const CAiwGenericParamList& aInParamList );
       
   116 
       
   117         /**
       
   118          * From CAiwServiceIfMenu.
       
   119          * 
       
   120          * Provider should implement this method to handle a menu command. Called by the 
       
   121          * Service Handler when a consumer calls ExecuteMenuCmdL().
       
   122          *
       
   123          * @param aMenuCmdId Original provider specific ommand ID for the menu command.
       
   124          *                   Defined in the provider's menu item resource.
       
   125          * @param aInParamList Input parameters, can be an empty list.
       
   126          * @param aOutParamList Output parameters, can be an empty list.
       
   127          * @param aCmdOptions Options for the command, see KAiwCmdOpt* in AiwCommon.hrh.
       
   128          * @param aCallback Callback if asynchronous command handling is wanted by consumer.
       
   129          *                  The provider may or may not support this. A provider should 
       
   130          *                  leave with KErrNotSupported, if not.
       
   131          * @leave KErrNotSupported Callback is not supported.
       
   132          */
       
   133         void HandleMenuCmdL( TInt aMenuCmdId, 
       
   134                 const CAiwGenericParamList& aInParamList, 
       
   135                 CAiwGenericParamList& aOutParamList, 
       
   136                 TUint aCmdOptions = 0, 
       
   137                 const MAiwNotifyCallback* aCallback = NULL );
       
   138         
       
   139     private: // from MCalProgressCallBack
       
   140         /**
       
   141          * Progress callback.
       
   142          * This calls the observing class with the percentage complete of the current operation.
       
   143          * @param aPercentageCompleted The percentage complete. 
       
   144          */
       
   145         void Progress( TInt aPercentageCompleted );
       
   146 
       
   147         /** 
       
   148          * Progress callback.      
       
   149          * This calls the observing class when the current operation is finished.      
       
   150          * @param aError The error if the operation failed, or KErrNone if successful.
       
   151          */
       
   152         void Completed( TInt aError );
       
   153 
       
   154         /**
       
   155          * Asks the observing class whether progress callbacks are required.   
       
   156          * @return If the observing class returns EFalse, then the Progress() function will not be called.
       
   157          */
       
   158         TBool NotifyProgress();
       
   159         
       
   160     private:
       
   161         /**
       
   162          * Resolve the file handle and return the entries after parsing the file.
       
   163          * @ aFileHandle Filehandle for the vcs/ics file received from consumer.
       
   164          */
       
   165         void ImportVCalendarL( RFile& aFileHandle );
       
   166         
       
   167         /**
       
   168          * Check whether more than one calendar is present in device.
       
   169          * @ return TBool True if more than one calendar present on device
       
   170          *                otherwise false. 
       
   171          */
       
   172         TBool HasMorethanOneCalendarL();
       
   173         
       
   174         /**
       
   175          * Save the entries to calendar without launching the dialog if only one
       
   176          * calnedar is there.
       
   177          * @ return TInt Error value if any otherwiths KErrNone. 
       
   178          */
       
   179         TInt SaveWithoutDialogL();
       
   180         
       
   181         /**
       
   182          * Save the entries to calendar after launching the dialog if more than one
       
   183          * calnedar is there.
       
   184          * @ return TInt Error value if any otherwiths KErrNone. 
       
   185          */
       
   186         TInt SaveWithDialogL();
       
   187         
       
   188         /**
       
   189          * Create the copy of the entries with new GUID.
       
   190          * @ aSrcDesEntryArray input/output paramenter which carry the entries.
       
   191          */
       
   192         void CreateCopyWithNewGuidL( RPointerArray<CCalEntry>& aSrcDesEntryArray );
       
   193         
       
   194     private:
       
   195         /**
       
   196          * C++ default constructor. Performs the 1st phase of 2-phase construction.
       
   197          * It must never leave.
       
   198          */
       
   199         CCalenAiwProvider();
       
   200 
       
   201         /**
       
   202          * Performs the 2nd phase of the 2-phase construction. It may leave.
       
   203          */
       
   204         void ConstructL();
       
   205 
       
   206     private:
       
   207         /*
       
   208          * @var iCalEntryArray.
       
   209          * @brief Stores the calendar entries.
       
   210          */
       
   211         RPointerArray<CCalEntry>    iCalEntryArray;
       
   212 
       
   213         /*
       
   214          * @var iSesstion.
       
   215          * @brief Carry the session for calendar.
       
   216          */
       
   217         CCalSession*                iCalSession;
       
   218         
       
   219         /*
       
   220          * @var iCalEntryView.
       
   221          * @brief Contain the object of entryview.
       
   222          */
       
   223         CCalEntryView*              iCalEntryView;
       
   224         
       
   225         /*
       
   226          * @var iCalEntryViewInitErrno.
       
   227          * @brief Contain the entry view intialization error if any.
       
   228          */ 
       
   229         TInt                        iCalEntryViewInitErrno;
       
   230         
       
   231         /*
       
   232          * @var iResourceFileName.
       
   233          * @brief Carry the resource file for calenaiwprovider.rss.
       
   234          */ 
       
   235         TFileName                   iResourceFileName;
       
   236 
       
   237         /*
       
   238          * @var iResourceFileOffset.
       
   239          * @brief Offset for the resource file.
       
   240          */ 
       
   241         TInt                        iResourceFileOffset;
       
   242         
       
   243         /*
       
   244          * @var iInterimUtils.
       
   245          * @brief Object for interimutils class.
       
   246          */ 
       
   247         CCalenInterimUtils2*        iInterimUtils;
       
   248     
       
   249     friend class CCalenaiwprovidertest;
       
   250     };
       
   251 
       
   252 #endif  // __CALENAIWPROVIDER_H__
       
   253 
       
   254 // End of file	--Don't delete this.