meetingrequest/mrgui/inc/cesmreditordialog.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     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:  ESMR editor dialog
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMREDITORDIALOG_H
       
    19 #define CESMREDITORDIALOG_H
       
    20 
       
    21 #include <AknDialog.h>
       
    22 #include <akntoolbarobserver.h>
       
    23 #include <AknServerApp.h>
       
    24 #include "mesmruibase.h"
       
    25 #include "mesmrresponseobserver.h"
       
    26 #include "mesmrfieldeventobserver.h"
       
    27 #include "cesmrfieldbuilderinterface.h"
       
    28 
       
    29 class CESMRPolicy;
       
    30 class MESMRCalEntry;
       
    31 class CESMRView;
       
    32 class MAgnEntryUiCallback;
       
    33 class CESMRSendUI;
       
    34 class CESMRField;
       
    35 class CESMRTitlePaneHandler;
       
    36 class CCalenInterimUtils2;
       
    37 class CESMRLocationPluginHandler;
       
    38 class CESMRAddressInfoHandler;
       
    39 class CESMRFeatureSettings;
       
    40 class CMRToolbar;
       
    41 class MMRInfoProvider;
       
    42 class TDataType;
       
    43 class MMRFocusStrategy;
       
    44 class MESMRMeetingRequestEntry;
       
    45 
       
    46 /**
       
    47  *  CESMREditorDialog implements the editor dialog for meeting requests.
       
    48  *
       
    49  *  @see mesmruibase.h, mesmruifactory.h
       
    50  *  @lib esmrgui.lib
       
    51  */
       
    52 NONSHARABLE_CLASS( CESMREditorDialog ) :
       
    53 		public CAknDialog,
       
    54 		public MESMRUiBase,
       
    55 		public MESMRResponseObserver,
       
    56 		public MESMRFieldEventObserver,
       
    57 		public MAknToolbarObserver
       
    58     {
       
    59 public:
       
    60     /**
       
    61      * Two-phased constructor.
       
    62      *
       
    63      * @param aPolicy contains all the fields for list component.
       
    64      * @param aEntry ESMR calendar entry (wraps the CCalEntry object)
       
    65      * @param aCallback Callback interface for AgnEntryUI
       
    66      * @return Pointer to created and initialized esmr editor dialog.
       
    67      */
       
    68     IMPORT_C static CESMREditorDialog* NewL(
       
    69             MMRInfoProvider& aInfoProvider,
       
    70             MAgnEntryUiCallback& aCallback );
       
    71 
       
    72     /*
       
    73      * Destructor.
       
    74      */
       
    75     ~CESMREditorDialog();
       
    76 
       
    77 public: // From CAknDialog
       
    78     SEikControlInfo CreateCustomControlL( TInt aType );
       
    79     TKeyResponse OfferKeyEventL(
       
    80             const TKeyEvent& aEvent,
       
    81             TEventCode aType);
       
    82     TBool OkToExitL ( TInt aButtonId );
       
    83     void ActivateL();
       
    84     void ProcessCommandL( TInt aCommand );
       
    85     void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    86 
       
    87 public: // From MESMRUIBase
       
    88     TInt ExecuteViewLD();
       
    89     
       
    90 public: // From MAknToolbarObserver
       
    91     void DynInitToolbarL ( TInt aResourceId, CAknToolbar* aToolbar );
       
    92     void OfferToolbarEventL ( TInt aCommand );  
       
    93     
       
    94 public: // From MESMRResponseObserver
       
    95     TBool Response( TInt aCommand );
       
    96     void ExitDialog();
       
    97     void ChangeReadyResponseL();
       
    98     
       
    99 protected: // From MESMRFieldEventObserver
       
   100     void HandleFieldEventL( const MESMRFieldEvent& aEvent );
       
   101 
       
   102 private: // Implementation
       
   103 
       
   104     void DoProcessCommandL( TInt aCommand );
       
   105 
       
   106     /**
       
   107      * Constructor.
       
   108      *
       
   109      * @param aEntry ESMR calendar entry (wraps the CCalEntry object)
       
   110      * @param aCallback Callback interface for AgnEntryUI
       
   111      */
       
   112     CESMREditorDialog(
       
   113             MMRInfoProvider& aPolicyProvider,
       
   114             MAgnEntryUiCallback& aCallback );
       
   115 
       
   116     /**
       
   117      * Second phase constructor.
       
   118      *
       
   119      * @param aPolicy contains all the fields for list component.
       
   120      */
       
   121     void ConstructL();
       
   122 
       
   123     /**
       
   124      * Handles dialog exit, saves entry etc.
       
   125      * @return TInt
       
   126      */
       
   127     TInt HandleExitL();
       
   128 
       
   129     /**
       
   130      * Handles dialog exit, saves, no queries.
       
   131      * @param aShowConfirmationQuery ETrue shows 'save changes' query before saving entry.
       
   132      * @return TInt
       
   133      */
       
   134     TInt HandleForcedExitL( TBool aShowConfirmationQuery = EFalse );
       
   135 
       
   136     /**
       
   137      * Sends calendar entry.
       
   138      * @param aCommandId
       
   139      */
       
   140     void SendCalendarEntryL(TInt aCommandId);
       
   141 
       
   142     /**
       
   143      * Tries to add send menu item to options menu if needed.
       
   144      * @param aMenuPane
       
   145      */
       
   146     void TryInsertSendMenuL(CEikMenuPane* aMenuPane);
       
   147 
       
   148     /**
       
   149      * Executes user related queries whether the entry should be
       
   150      * save or not.
       
   151      * @return TBool
       
   152      */
       
   153     TBool IsAllowedToSaveL();
       
   154 
       
   155     /**
       
   156      * Checks if cfsmailbox supports given capability.
       
   157      * @param aCapa, the capability
       
   158      * @return TBool
       
   159      */
       
   160     TBool SupportsMailBoxCapabilityL( 
       
   161             MESMRBuilderExtension::TMRCFSMailBoxCapability aCapa );
       
   162     
       
   163     /**
       
   164      * Handle options menu command "open"
       
   165      */
       
   166     void HandleOpenCmdL();
       
   167 
       
   168     /**
       
   169      * Handles Location Options submenu content
       
   170      * 
       
   171      * @param aResourceId Menu resource id
       
   172      * @param aMenuPane menu pane 
       
   173      */
       
   174     void HandleLocationOptionsL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   175     
       
   176     CESMRLocationPluginHandler& LocationPluginHandlerL();
       
   177     CESMRAddressInfoHandler& AddressInfoHandlerL();
       
   178     void HandleFieldCommandEventL( const MESMRFieldEvent& aEvent );
       
   179     void HandleFieldChangeEventL( const MESMRFieldEvent& aEvent );
       
   180     TBool SetContextMenuL();
       
   181     void SwitchEntryTypeL( TInt aCommand, TBool aAdjustView );
       
   182     inline const CESMRPolicy& Policy() const;
       
   183     void SetTitleL();
       
   184     void VerifyMeetingRequestL();
       
   185     TBool TryOpenAttachmentL();
       
   186     TInt TryRemoveAttachmentL();   
       
   187     TInt TryRemoveAllAttachmentsL();
       
   188     TInt TryAddAttachmentL();
       
   189     void ShowContextMenuL();
       
   190     
       
   191     /**
       
   192      * Check mr is past
       
   193      * 
       
   194      * @param aEvent
       
   195      * @return TBool
       
   196      */
       
   197     TBool OccursInPastL( const MESMRFieldEvent& aEvent );    
       
   198     TBool OccursInPast( const TTime& aStartUtc );
       
   199     void ChangeRightSoftkeyL( TBool aOccursInPast, TBool aIsOrganizer );
       
   200     
       
   201     TInt TryToSaveEntryL();
       
   202     
       
   203 private:
       
   204 
       
   205     /**
       
   206      * Ref: Info provider for accessing entry and policy
       
   207      */
       
   208     MMRInfoProvider& iInfoProvider;
       
   209 
       
   210     /**
       
   211      * Ref: The only control in this dialog. Fwk deletes.
       
   212      */
       
   213     CESMRView* iView;
       
   214 
       
   215     /**
       
   216      * Ref: Agn Entry UI callback interface
       
   217      */
       
   218     MAgnEntryUiCallback& iCallback;
       
   219 
       
   220     /**
       
   221      * Own: Calendar Global data
       
   222      */
       
   223     CESMRSendUI* iESMRSendUI;
       
   224 
       
   225     /**
       
   226      * Own: Boolean indicating if required attendees field contains items.
       
   227      */
       
   228     TBool iRequiredAttendeesEnabled;
       
   229 
       
   230     /**
       
   231      * Own: Boolean indicating if optional attendees field contains items.
       
   232      */
       
   233     TBool iOptionalAttendeesEnabled;
       
   234 
       
   235     /// Own: Titlepane handler
       
   236     CESMRTitlePaneHandler* iTitlePane;
       
   237 
       
   238     /**
       
   239      * Pointer to instance of CCalenInterimUtils2.
       
   240      * Own: Release on destruct.
       
   241      */
       
   242     CCalenInterimUtils2* iInterimUtils;
       
   243     
       
   244 	/**
       
   245 	 * Location plugin handler.
       
   246 	 * Own.
       
   247 	 */
       
   248     CESMRLocationPluginHandler* iLocationPluginHandler;
       
   249 	
       
   250     /**
       
   251      * Address info handler.
       
   252      * Own.
       
   253      */
       
   254     CESMRAddressInfoHandler* iAddressInfoHandler;
       
   255     
       
   256     /**
       
   257      * Feature settings.
       
   258      * Own.
       
   259      */
       
   260     CESMRFeatureSettings* iFeatures;
       
   261     
       
   262     /**
       
   263      * Indicates if location has been modified.
       
   264      */
       
   265     TBool iLocationModified;
       
   266     /// Own: Toolbar handler
       
   267     CMRToolbar* iToolbar;
       
   268     
       
   269     /// Own: Context menu resource id
       
   270     TInt iContextMenuResourceId;
       
   271     /// Own: Focus strategy of the editor
       
   272     MMRFocusStrategy* iFocusStrategy;
       
   273     
       
   274     // record time after time field updated
       
   275     TTime iStartTimeUtc;
       
   276     };
       
   277 
       
   278 #endif  // CESMREDITORDIALOG_H