calendarui/controller/inc/caleneditui.h
changeset 0 f979ecb2b13e
child 29 12af337248b1
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2005 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:   Controller class for editing related UI behavior
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __EDITUI_H__
       
    21 #define __EDITUI_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <calentry.h>
       
    25 #include <e32base.h>
       
    26 #include <AknWaitDialog.h>
       
    27 #include <MAgnEntryUi.h>
       
    28 #include <calcommon.h>
       
    29 #include <cmrmailboxutils.h>             // CMRMailboxUtils::TMailboxInfo
       
    30 #include <calencommandhandler.h>
       
    31 #include <calennotificationhandler.h>   // MCalenNotificationHandler
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CCalenEditorsPlugin;
       
    35 class CCalenView;
       
    36 class CCalInstance;
       
    37 class CCalenGlobalData;
       
    38 class CCalenController;
       
    39 
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * CCalenEditUi encapsulates editing related behavior in Calendar application.
       
    45  *
       
    46  */
       
    47 NONSHARABLE_CLASS( CCalenEditUi ) : public CBase, 
       
    48                                     public MAgnEntryUiCallback,
       
    49                                     public MCalenNotificationHandler,
       
    50                                     public MCalenCommandHandler,
       
    51                                     public MProgressDialogCallback
       
    52     {
       
    53     
       
    54     public: // public API
       
    55         /**
       
    56          * Symbian 1st phase construction
       
    57          * @param aController Reference of the controller that owns the editui
       
    58          */
       
    59         static CCalenEditUi* NewL( CCalenController& aController );
       
    60 
       
    61         /**
       
    62          * Destructor
       
    63          */
       
    64         virtual ~CCalenEditUi();
       
    65 
       
    66     public: // From MCalenCommandHandler
       
    67 
       
    68         /**
       
    69          * Handles key presses.
       
    70          * 
       
    71          * @param aCommand The command Id of the key.
       
    72          */
       
    73         TBool HandleCommandL( const TCalenCommand& aCommand );
       
    74 
       
    75         /**
       
    76          * Allows extending this API without breaking BC.
       
    77          * 
       
    78          * @param aExtensionUid specifies
       
    79          * @return extension of the requested type
       
    80          */
       
    81         TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
       
    82 
       
    83     protected:  // From MProgressDialogCallback
       
    84 
       
    85         /**
       
    86          * From MProgressDialogCallback
       
    87          * Callback method
       
    88          * called when a dialog is dismissed
       
    89          */
       
    90         void DialogDismissedL( const TInt aButtonId );
       
    91 
       
    92     public:  // New functions
       
    93 
       
    94         /**
       
    95          * Creates a new entry of type aType and launches the editor
       
    96          * @param aType type of new entry
       
    97          */
       
    98         void EditNewEntryL( CCalEntry::TType aEntryType = CCalEntry::EAppt );
       
    99 
       
   100         /**
       
   101          * Creates a new meeting request and launches the editor
       
   102          */
       
   103         void EditNewMeetingRequestL();
       
   104 
       
   105         /**
       
   106          * Launches editor for aEntry
       
   107          * @param aEntry entry to be edited
       
   108          * @param aInstancetime Instance time of the entry
       
   109          * @param aEditorMode Edit mode, EViewEntry/EEditEntry
       
   110          */
       
   111         void EditEntryL( CCalEntry* aEntry,
       
   112                 const TTime& aInstanceTime,
       
   113                 MAgnEntryUi::TAgnEntryUiEditorMode aEditorMode = MAgnEntryUi::EViewEntry );
       
   114 		
       
   115 		/**
       
   116          * Function to tell whether editor is active or not
       
   117          * @return ETrue if editor is active else EFalse
       
   118          */
       
   119         TBool IsEditorActive();
       
   120 		
       
   121     public:  // From MCalenNotificationHandler
       
   122 
       
   123         /** 
       
   124          * Handle notifications
       
   125          * @param aNotification Nofication to be handled
       
   126          */
       
   127         void HandleNotification(const TCalenNotification aNotification );
       
   128 
       
   129     protected: // From MAgnEntryUiCallback
       
   130 
       
   131         /**
       
   132          * Pure virtual function from MAgnEntryUiCallback
       
   133          * Not used
       
   134          * @param aCommandId Command id to be processed
       
   135          */
       
   136         TInt ProcessCommandWithResultL( TInt aCommandId );
       
   137 
       
   138         /**
       
   139          * Handle Command
       
   140          * @param aCommandId Command id to be handled
       
   141          */
       
   142         void ProcessCommandL( TInt aCommandId );
       
   143 
       
   144     private: // own methods
       
   145 
       
   146         /**
       
   147          * C++ constructor
       
   148          * @param aController Reference to the controller that owns the caleneditui
       
   149          */
       
   150         CCalenEditUi( CCalenController& aController );
       
   151 
       
   152         /**
       
   153          * Symbian 2nd phase constructor
       
   154          */
       
   155         void ConstructL();
       
   156 
       
   157         /**
       
   158          * Attempts to load the editors plugin into iEditorsPlugin. If failure occurs
       
   159          * (for example, if the user is prompted to select a default mailbox and hits
       
   160          * cancel), iEditorsPlugin is set to NULL.
       
   161          */
       
   162         void LoadEditorsPluginL();
       
   163 
       
   164         /**
       
   165          * If aComplete is ETrue, sets the todo as complete.
       
   166          * Otherwise sets the todo as incomplete.
       
   167          * @param aComplete Complete status to be set
       
   168          */
       
   169         void SetTodoCompleteL( TBool aComplete );
       
   170 
       
   171         /**
       
   172          * If aComplete is ETrue, sets the todo as complete.
       
   173          * Otherwise sets the todo as incomplete.
       
   174          * @param aComplete Complete status to be set
       
   175          */
       
   176         void SetTodoEntryCompleteL( TBool aComplete, TCalLocalUid aEntryUid,TCalCollectionId colId);
       
   177 
       
   178         /**
       
   179          * If aComplete is ETrue, sets the todo as complete.
       
   180          * Otherwise sets the todo as incomplete.
       
   181          * @param aComplete Complete status to be set
       
   182          */
       
   183         TBool SetMultipleTodoCompleteL(TBool aComplete);
       
   184 
       
   185         /**
       
   186          * Sends the current entry.
       
   187          */
       
   188         void SendEntryL();
       
   189 
       
   190         /**
       
   191          * Register for view created notification
       
   192          * @param aCommand Command that is going to be handled when view is created
       
   193          */
       
   194         void WaitForEntryViewNotificationL( const TCalenCommand& aCommand );
       
   195 
       
   196         /**
       
   197          * Leaving function that handles ECalenNotifyViewCreated
       
   198          */
       
   199         void HandleECalenNotifyViewCreatedL();
       
   200 
       
   201         void DisplayWaitDialogL();
       
   202 
       
   203         void MarkedEntriesCompletedL();
       
   204 
       
   205         /**
       
   206          * Calculate active time from context
       
   207          * 
       
   208          * @TTime returns the ttime 
       
   209          */
       
   210         TTime CalculateActiveTimeFromContextL();
       
   211 
       
   212     private: // data
       
   213         MAgnEntryUi*            iEditorsPlugin;
       
   214         CCalenGlobalData*       iGlobalData;
       
   215         CCalenController&       iController;
       
   216         CDesCArrayFlat*         iListItems;
       
   217         CArrayFix<TInt>*        iListItemCommands;
       
   218         CAknWaitDialog* iWaitDialog;
       
   219 
       
   220         // Stored command if the entry view 
       
   221         // needs to constructed asyncronously
       
   222         TCalenCommand iStoredCommand;
       
   223 
       
   224         TInt iMutlipleContextIdsCount;
       
   225         TInt iEntriesToComplete;
       
   226         TBool iMoreEntriesToComplete;
       
   227         TBool isEditorActive; // to inform framework if editor is active
       
   228                
       
   229     };
       
   230 
       
   231 #endif // __EDITUI_H__
       
   232 
       
   233 // End of File