calendarui/controller/inc/caleneditui.h
changeset 89 b57382753122
parent 83 5aadd1120515
equal deleted inserted replaced
83:5aadd1120515 89:b57382753122
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Controller class for editing related UI behavior
    14 * Description:   Controller class for editing related UI behavior
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #ifndef __CALENEDITUI_H__
    19 
    20 #define __CALENEDITUI_H__
    20 #ifndef __EDITUI_H__
    21 
    21 #define __EDITUI_H__
    22 #include <QObject>
       
    23 
    22 
    24 // INCLUDES
    23 // INCLUDES
    25 #include "calennotificationhandler.h"   // MCalenNotificationHandler
    24 #include <calentry.h>
    26 #include "calencommandhandler.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
    27 
    32 
    28 // FORWARD DECLARATIONS
    33 // FORWARD DECLARATIONS
       
    34 class CCalenEditorsPlugin;
       
    35 class CCalenView;
    29 class CCalInstance;
    36 class CCalInstance;
       
    37 class CCalenGlobalData;
    30 class CCalenController;
    38 class CCalenController;
    31 class CalenEditor;
       
    32 
    39 
    33 
    40 
    34 // CLASS DECLARATION
    41 // CLASS DECLARATION
    35 
    42 
    36 /**
    43 /**
    37  * CCalenEditUi encapsulates editing related behavior in Calendar application.
    44  * CCalenEditUi encapsulates editing related behavior in Calendar application.
    38  *
    45  *
    39  */
    46  */
    40 class CCalenEditUi : public QObject,
    47 NONSHARABLE_CLASS( CCalenEditUi ) : public CBase, 
    41 									public MCalenNotificationHandler,
    48                                     public MAgnEntryUiCallback,
    42                                     public MCalenCommandHandler
    49                                     public MCalenNotificationHandler,
       
    50                                     public MCalenCommandHandler,
       
    51                                     public MProgressDialogCallback
    43     {
    52     {
    44     Q_OBJECT
       
    45     
    53     
    46     public: // public API
    54     public: // public API
    47         /**
    55         /**
    48          * Symbian 1st phase construction
    56          * Symbian 1st phase construction
    49          * @param aController Reference of the controller that owns the editui
    57          * @param aController Reference of the controller that owns the editui
    50          */
    58          */
    51         static CCalenEditUi* NewL( CCalenController& aController );
    59         static CCalenEditUi* NewL( CCalenController& aController );
    52         
    60 
    53         /**
    61         /**
    54          * Destructor
    62          * Destructor
    55          */
    63          */
    56         virtual ~CCalenEditUi();
    64         virtual ~CCalenEditUi();
    57 
    65 
    58     public:  // MCalenCommandHandler
    66     public: // From MCalenCommandHandler
    59         /**
    67 
    60          * Handles action ui commands
    68         /**
    61          * @param aCommand Command to be handled
    69          * Handles key presses.
       
    70          * 
       
    71          * @param aCommand The command Id of the key.
    62          */
    72          */
    63         TBool HandleCommandL( const TCalenCommand& aCommand );
    73         TBool HandleCommandL( const TCalenCommand& aCommand );
    64     
    74 
    65     public:  // from MCalenNotificationHandler
    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 
    66         /** 
   123         /** 
    67          * Handle notifications
   124          * Handle notifications
    68          * @param aNotification Nofication to be handled
   125          * @param aNotification Nofication to be handled
    69          */
   126          */
    70         void HandleNotification(const TCalenNotification aNotification );
   127         void HandleNotification(const TCalenNotification aNotification );
    71         
   128 
    72         /**
   129     protected: // From MAgnEntryUiCallback
    73         * This Function saves the entries
   130 
    74         * should only calls after edit or create function has called 
   131         /**
    75         */
   132          * Pure virtual function from MAgnEntryUiCallback
    76         void saveAndCloseEditor();
   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 );
    77 
   143 
    78     private: // own methods
   144     private: // own methods
       
   145 
    79         /**
   146         /**
    80          * C++ constructor
   147          * C++ constructor
    81          * @param aController Reference to the controller that owns the caleneditui
   148          * @param aController Reference to the controller that owns the caleneditui
    82          */
   149          */
    83         CCalenEditUi( CCalenController& aController);
   150         CCalenEditUi( CCalenController& aController );
    84         
   151 
    85         /**
   152         /**
    86          * Symbian 2nd phase constructor
   153          * Symbian 2nd phase constructor
    87          */
   154          */
    88         void ConstructL();
   155         void ConstructL();
    89         
   156 
    90     private slots:
   157         /**
    91 		
   158          * Attempts to load the editors plugin into iEditorsPlugin. If failure occurs
    92 		void handleEntrySaved();
   159          * (for example, if the user is prompted to select a default mailbox and hits
    93 		void handleDialogClosed();
   160          * cancel), iEditorsPlugin is set to NULL.
    94 		void handleForcedExit();
   161          */
    95         
   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 
    96     private: // data
   212     private: // data
    97         
   213         MAgnEntryUi*            iEditorsPlugin;
       
   214         CCalenGlobalData*       iGlobalData;
    98         CCalenController&       iController;
   215         CCalenController&       iController;
    99         CalenEditor*			iEditor;
   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                
   100     };
   229     };
   101 
   230 
   102 #endif // __CALENEDITUI_H__
   231 #endif // __EDITUI_H__
   103 
   232 
   104 // End of File
   233 // End of File