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