eventsui/eventseditor/inc/evtmgmtuieditorcmdhandler.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2008 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:   It is handler class to handle editor commands
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef EVTMGMTUIEDITORCMDHANDLER_H_
       
    20 #define EVTMGMTUIEDITORCMDHANDLER_H_
       
    21 
       
    22 #include <e32base.h>        // CBase
       
    23 #include <locsettingsuiclient.h>
       
    24 #include "evtdefs.h"
       
    25 #include "evtmgmtuiengine.h"
       
    26 #include "evtmgmtuiwaitdlglauncher.h"
       
    27 
       
    28 class CEvtEditor;
       
    29 class CEvtEvent;
       
    30 class TCoordinate;
       
    31 class CEvtMgmtUiPlaceComponent;
       
    32 class CAknIconArray;
       
    33 class CAknListQueryDialog;
       
    34 class TAknsItemID;
       
    35 class CEvtMgmtUiWaitDialogLauncher;
       
    36 class CEvtMgmtUiDescComponent;
       
    37 class CEvtMgmtUiMapNavigationAdapter;
       
    38 class CEvtMgmtUiRingtoneComponent;
       
    39 
       
    40 class MEvtMgmtUiEditorObserver
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * It will be used to notify editor that command has been handled
       
    45      * @param aCommandId Id of the command pressed
       
    46      * @param aErrorCode It will contain the status of the operation
       
    47      *                KErrNone if successful otherwise error code          
       
    48      */
       
    49     virtual void NotifyEditorL( TInt aCommand, 
       
    50                                 TInt aErrorCode )=0;
       
    51     };
       
    52 
       
    53 /**
       
    54  *  @class CEvtMgmtUiEditorCmdHandler
       
    55  *  Class that represents command handler for editor
       
    56  *
       
    57  *  This class acts as command handler of editor.
       
    58  *  It  is used to :
       
    59  *      To activate event
       
    60  *      To save event as draft
       
    61  *      To save event as completed
       
    62  *      To delete event
       
    63  *      To add/edit/remove description
       
    64  *      To add/change place
       
    65  *      To assign ringtone
       
    66  *      To show event on map
       
    67  *      To navigate to place
       
    68  *      To launch position settings
       
    69  *
       
    70  *  @since S60 v9.1
       
    71  */
       
    72 
       
    73 class CEvtMgmtUiEditorCmdHandler : public CActive,
       
    74                                    public MEvtMgmtUiEngineObserver,
       
    75                                    public MEvtMgmtUiWaitDialogLauncherObserver
       
    76     {
       
    77     public:  // Constructor and destructor  
       
    78       /**
       
    79        * Static Two phase constructor
       
    80        * 
       
    81        * @since Symbian v9.1
       
    82        *
       
    83        * @param[in/out] aEvent - event object which contains current event information.
       
    84        *                         event details may be changed while executing commands
       
    85        * @param[in] aEditorObserver - observer to handle editor specific operations 
       
    86        *                              after command is executed
       
    87        */
       
    88       static CEvtMgmtUiEditorCmdHandler* NewL( 
       
    89                         CEvtEvent&                      aEvent, 
       
    90                         MEvtMgmtUiEditorObserver&       aEditorObserver,
       
    91                         CEvtMgmtUiEngine&               aEventEngine );
       
    92 
       
    93       /**
       
    94        * Virtual destructor
       
    95        */
       
    96       virtual ~CEvtMgmtUiEditorCmdHandler(); 
       
    97       
       
    98     public: // new functions
       
    99         /**
       
   100          * It will handle all editor commands.
       
   101          * 
       
   102          * @since Symbian v9.1
       
   103          * 
       
   104          * @param[in] aCommand - command id of the command to be handled
       
   105          * @param[out] aResult - Result of the command operation
       
   106          */
       
   107         void HandleEditorCmdL( TInt     aCommand );
       
   108         
       
   109          /*
       
   110           * It will handle add/edit/remove description operation.
       
   111           * 
       
   112           * @since Symbian v9.1
       
   113           * 
       
   114           * @param[in] aCommand - Command id of the operation to be performed.
       
   115           */
       
   116          TInt HandleDescCommandsL( TInt     aCommand );
       
   117          
       
   118          /*
       
   119           * It will handle assign tone operation.
       
   120           * 
       
   121           * @since Symbian v9.1
       
   122           * 
       
   123           * @ret returns KErrNone if successfully handled else error
       
   124           */
       
   125          TInt HandleAssignToneCommandL();
       
   126          
       
   127          /*
       
   128           * It will handle 'show on map' operation.
       
   129           * 
       
   130           * @since Symbian v9.1
       
   131           * 
       
   132           */
       
   133          void HandleShowOnMapCommandL();
       
   134          
       
   135          /*
       
   136           * It will handle 'navigate to place' operation.
       
   137           * 
       
   138           * @since Symbian v9.1
       
   139           * 
       
   140           */
       
   141          void HandleNavigateToPlaceCommandL();
       
   142          
       
   143          /*
       
   144           *  It will set attribute mask which will be used to update event.
       
   145           * 
       
   146           *  @since Symbian v9.1
       
   147           * 
       
   148           */
       
   149          void SetEventAttributeMask( TEvtEventAttributeMask aEventAttributeMask );
       
   150                  
       
   151    public: //derived
       
   152         /**
       
   153         * Derived from CActive
       
   154         */
       
   155         void RunL();
       
   156         
       
   157         /**
       
   158         * Derived from CActive
       
   159         */
       
   160         TInt RunError( TInt aError );
       
   161         
       
   162         /**
       
   163         * Derived from CActive
       
   164         */
       
   165         void DoCancel();
       
   166         
       
   167         /**
       
   168         * Inherited from MEvtMgmtUiEngineObserver
       
   169         */
       
   170         void NotifyEventChangeL(TInt aErrorCode, TInt aState );
       
   171         
       
   172         /**
       
   173         * Inherited from MEvtMgmtUiEngineObserver
       
   174         */
       
   175         void NotifyModelChangeL();
       
   176         
       
   177         /**
       
   178         * Inherited from MEvtMgmtUiWaitDialogLauncherObserver
       
   179         */
       
   180         void HandleDialogDismissed( TInt aButtonId );
       
   181       
       
   182     private:  // Constructor
       
   183         /**
       
   184          * C++ Default constructor
       
   185          */       
       
   186         CEvtMgmtUiEditorCmdHandler(
       
   187                     CEvtEvent&                          aEvent,
       
   188                     MEvtMgmtUiEditorObserver&           aEditorObserver,
       
   189                     CEvtMgmtUiEngine&                   aEventEngine );
       
   190   
       
   191         /**
       
   192          * Second phase of the two phase constructor
       
   193          */ 
       
   194          void ConstructL();
       
   195          
       
   196     private:         
       
   197          /**
       
   198          * It will display comfirmation query dialog
       
   199          * 
       
   200          * @since Symbian v9.1
       
   201          * 
       
   202          * @param[in] aResourceId - resource id of the resource to be displayed 
       
   203          *                           on confirmation query dialog.
       
   204          * @ret returns true if OK is pressed.
       
   205          *      returns false if Cancel is pressed. 
       
   206          */
       
   207          TBool DisplayConfirmationQueryDlgL( TInt aResourceId );
       
   208 
       
   209          /*
       
   210           * It will handle'set place' operation.
       
   211           * 
       
   212           * @since Symbian v9.1
       
   213           * 
       
   214           */
       
   215          void HandleSetPlaceCommandL();
       
   216                         
       
   217          /**
       
   218           * Start wait Dialog for asynchronous processing.
       
   219           */
       
   220          void StartWaitDialogL(TInt aResourceId);
       
   221                         
       
   222          /**
       
   223           * Stop outstanding wait Dialog.
       
   224           */
       
   225          void StopWaitDialogL();
       
   226                         
       
   227          /**
       
   228           * It is used to update icons
       
   229           */
       
   230          void UpdateIconsL( CAknListQueryDialog* aDialog );    
       
   231           
       
   232          /**
       
   233           * Append icon to icon array. CAknIconArray owns icons so it is 
       
   234           * easier to it leave safely.
       
   235           * @param aIcons icon array
       
   236           * @param aIconFileWithPath icon file name with path
       
   237           * @param aSkinID skin id of the icon
       
   238           * @param aIconGraphicsIndex picture index
       
   239           * @param aIconGraphicsMaskIndex mask index
       
   240           */
       
   241          void AddIconL( CAknIconArray&       aIcons,
       
   242                         const TDesC&         aIconFileWithPath,
       
   243                         TAknsItemID          aSkinID,
       
   244                         TInt                 aIconGraphicsIndex,
       
   245                         TInt                 aIconGraphicsMaskIndex );
       
   246                               
       
   247          /**
       
   248           * Gets Events Management UI icon file path and name. Ownership
       
   249           * is transferred, item is left in the cleanup stack.
       
   250           * @return TFileName* The full name of the Events UI icon file.
       
   251           */        
       
   252          TFileName* IconFileNameLC() const;
       
   253          
       
   254     private:
       
   255         /*
       
   256          *  state-machine's state
       
   257          */
       
   258         TInt                            iState;
       
   259 		
       
   260         /*
       
   261          *  The event to be displayed on editor
       
   262          */
       
   263         CEvtEvent&                      iEvent;      
       
   264 		
       
   265         /*
       
   266          *  It performs all editor specific operation when command is executed
       
   267          */
       
   268         MEvtMgmtUiEditorObserver&       iEditorObserver;
       
   269 		
       
   270         /*
       
   271          * Owns: 'Set place' component object
       
   272          * It retrieves place and location information
       
   273          */
       
   274         CEvtMgmtUiPlaceComponent*       iPlaceComponent;
       
   275 		
       
   276         /*
       
   277          * Owns: It launches position settings
       
   278          */
       
   279         CLocSettingsUiClient*                   iClientLibrary;
       
   280         
       
   281         /*
       
   282          * Description Component Instance
       
   283          * Owns
       
   284          */
       
   285         CEvtMgmtUiDescComponent* iDescComponent;
       
   286         
       
   287         /*
       
   288          * Map Component Instance
       
   289          * Owns
       
   290          */
       
   291         CEvtMgmtUiMapNavigationAdapter* iMapAdapter;
       
   292         
       
   293         /*
       
   294          * Ringtone Component Instance
       
   295          * Owns
       
   296          */
       
   297         CEvtMgmtUiRingtoneComponent* iRingtoneComponent; 
       
   298         
       
   299         /**
       
   300         * Wait dialog launcher
       
   301         * Owns
       
   302         */ 
       
   303         CEvtMgmtUiWaitDialogLauncher*   iWaitDialogLauncher;
       
   304         
       
   305         /**
       
   306          * Reference to the Events UI Engine
       
   307          */
       
   308         CEvtMgmtUiEngine&               iEventEngine;      
       
   309         
       
   310         /*
       
   311          * List of events id to be deleted/updated
       
   312          * Owns
       
   313          */
       
   314         RArray<TEvtEventId> iEvtIdArray;     
       
   315         
       
   316         /*
       
   317          * It indicates if any Dialog is outstanding
       
   318          */
       
   319         TBool   iIsDlgOutstanding;
       
   320         
       
   321         /*
       
   322          * It determines which attributes are modified
       
   323          */
       
   324         TEvtEventAttributeMask          iEventAttributeMask;
       
   325     };
       
   326 
       
   327 #endif //EVTMGMTUIEDITORCMDHANDLER_H_