calendarui/controller/inc/calendeleteui.h
changeset 0 f979ecb2b13e
child 29 12af337248b1
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007 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 deleting related UI behavior
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALENDELETEUI_H
       
    21 #define CALENDELETEUI_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <calcommon.h>
       
    26 #include <eikenv.h>
       
    27 #include <AknWaitDialog.h>
       
    28 #include <calprogresscallback.h>
       
    29 #include <calencommandhandler.h>
       
    30 #include <calennotificationhandler.h>
       
    31 #include <calenactionuiutils.h>
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CAknWaitDialog;
       
    35 class CCalenGlobalData;
       
    36 class CCalenController;
       
    37 class CCalInstanceView;
       
    38 class CCalInstance;
       
    39 class CCalEntry;
       
    40 class CCalEntryView;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 /**
       
    44  * CCalenDeleteUi encapsulates deleting related behavior
       
    45  * in Calendar application.
       
    46  */
       
    47 NONSHARABLE_CLASS( CCalenDeleteUi ) : public CBase,
       
    48                                       public MCalProgressCallBack,
       
    49                                       public MCalenNotificationHandler,
       
    50                                       public MCalenCommandHandler,
       
    51                                       public MProgressDialogCallback
       
    52     {
       
    53 
       
    54     public: // public API
       
    55 	
       
    56         /**
       
    57          * Symbian 1st phase constructor
       
    58          * @param aController Reference to CCalenController
       
    59          */
       
    60         static CCalenDeleteUi* NewL( CCalenController& aController );
       
    61 
       
    62         /**
       
    63          * Destructor
       
    64          */
       
    65         virtual ~CCalenDeleteUi();
       
    66 
       
    67     public: // From MCalenCommandHandler
       
    68         
       
    69         /**
       
    70          * Handles key presses.
       
    71          * 
       
    72          * @param aCommand The command Id of the key.
       
    73          */
       
    74         TBool HandleCommandL( const TCalenCommand& aCommand );
       
    75         
       
    76         /**
       
    77          * Allows extending this API without breaking BC.
       
    78          * 
       
    79          * @param aExtensionUid specifies
       
    80          * @return extension of the requested type
       
    81          */
       
    82         TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
       
    83 
       
    84     public:  // New functions
       
    85         /**
       
    86          * UI sequence for deleting single entry. Shows UI queries and notes and
       
    87          * performs delete. Current entry is taken from Calendar Context
       
    88          */
       
    89         void DeleteCurrentEntryL();
       
    90 
       
    91         /**
       
    92          * UI sequence for deleting all entries. Shows UI queries and notes and
       
    93          * performs delete asynchronosuly.
       
    94          */
       
    95         void DeleteAllEntriesL();
       
    96 
       
    97         /**
       
    98          * UI sequence for deleting entries before given date.
       
    99          * Shows UI queries and notes and performs delete asynchronosuly.
       
   100          */
       
   101         void DeleteEntriesBeforeDateL();
       
   102 
       
   103         /**
       
   104          * UI sequence for deleting series repeating entry
       
   105          * Becasue a ThisAndAll repeat type has already been chosen by user,
       
   106          * no repeat query is required. Performs delete asynchronosuly.
       
   107          */
       
   108         void DeleteThisOrAllL( CalCommon::TRecurrenceRange aRepeatType );
       
   109 
       
   110     public:  // from MCalenNotificationHandler
       
   111         /**
       
   112          * Handle notifications
       
   113          * @param aNotification Notification to be handled
       
   114          */
       
   115         void HandleNotification(const TCalenNotification aNotification );
       
   116 
       
   117     private: // From MCalProgressCallBack
       
   118         /**
       
   119          * From MCalProgressCallBack
       
   120          */
       
   121         void Completed( TInt aError );
       
   122 
       
   123         /**
       
   124          * From MCalProgressCallBack
       
   125          */
       
   126         TBool NotifyProgress();
       
   127 
       
   128         /**
       
   129          * From MCalProgreeCallBack
       
   130          */
       
   131         void Progress( TInt aPercentageCompleted );
       
   132 
       
   133     private: // own methods
       
   134         /**
       
   135          * Handles deleting all entries in time range from aFirstDay to aLastDay.
       
   136          * Shows wait notification and given confirmation notifications.
       
   137          */
       
   138         void HandleDeleteMultipleEventsL( const TTime& aFirstDay,
       
   139                 const TTime& aLastDay,
       
   140                 TInt aConfNoteId );
       
   141 
       
   142         /**
       
   143          * Delete entries from given range
       
   144          */
       
   145         void DeleteDayRangeL( const TTime& aStart, const TTime& aEnd );
       
   146 
       
   147         /**
       
   148          * Delete entries than end at given midnight.
       
   149          * This is needed when deleting multiple entries, to handle
       
   150          * e.g all-day notes that extends to next day's midnight.
       
   151          */
       
   152         void DeleteEntriesEndingAtMidnightL( TTime aMidnight );
       
   153 
       
   154         /**
       
   155          * just a wrapper for leave
       
   156          */
       
   157         void DoCompletedL( TInt aFirstPassError );
       
   158 
       
   159         /**
       
   160          * Delete entry by passing CCalEntryView and CCalEntry
       
   161          * Will query user for confirmation before deletion
       
   162          * @return ETrue user confirms to delete EFalse otherwise 
       
   163          */
       
   164         TBool DeleteEntryL( CCalEntryView* aEntryView, CCalEntry* aEntry );
       
   165 
       
   166         /**
       
   167          * Delete entry without querying the user
       
   168          */
       
   169         TBool DeleteEntryWithoutQueryL();
       
   170 
       
   171         /**
       
   172          * Delete the given entry. Ask the user whether to delete the
       
   173          * instance or the entire series.
       
   174          */
       
   175         TBool DeleteSingleInstanceL( CCalInstance* aInstance );
       
   176 
       
   177         /**
       
   178          * Delete the given entry, using aRepeatType to determine
       
   179          * whether to delete the instance or the entire series.
       
   180          */
       
   181         TBool DeleteSingleInstanceL( CCalInstance* aInstance, 
       
   182                 CalCommon::TRecurrenceRange aRepeatType );
       
   183 
       
   184         /**
       
   185          * Show the confirmation query with confirmation type and number of entries this query is for
       
   186          * @param aType Type of query: EDeleteEntry/ EDeleteTodo/ EDeleteTodos/ EDeleteAll
       
   187          */
       
   188         TInt ShowDeleteConfirmationQueryL( const CalenActionUiUtils::TDeleteConfirmationType aType,
       
   189                 const TInt aCount=0 );
       
   190 
       
   191         /**
       
   192          * Delete single instance.
       
   193          * @param aInstance Pointer to the instance to be deleted
       
   194          * @param aHasRepeatType Whether or not the instance is repeating
       
   195          * @param aRepeatType Repeat type choosen to apply on delete
       
   196          * @return ETrue is user confirms to delete, EFalse otherwise
       
   197          */
       
   198         TBool DoDeleteSingleInstanceL( CCalInstance* aInstance,
       
   199                 TBool aHasRepeatType,
       
   200                 CalCommon::TRecurrenceRange aRepeatType );
       
   201 
       
   202         /**
       
   203          * Attempt to delete the instance using the Meeting Request utilities,
       
   204          * if MR viewers is enabled.
       
   205          * @param aInstance Pointer to the instance to be delete
       
   206          * @param aRepeatType Repeat Type choosen to apply on delete
       
   207          * @return ETrue if user confirms to delete, EFalse otherwise
       
   208          */
       
   209         TBool TryDeleteWithMrUtilsL( CCalInstance* aInstance, 
       
   210                 CalCommon::TRecurrenceRange aRepeatType );
       
   211 
       
   212         /**
       
   213          * Leaving function, handle ECalenNotifyViewCreated
       
   214          */
       
   215         void HandleECalenNotifyViewCreatedL();
       
   216 
       
   217         /**
       
   218          * Multiple entries delete query
       
   219          */ 
       
   220         TInt ShowMultipleEntriesDeleteQueryL(TInt aCount);
       
   221 
       
   222     private: // own methods
       
   223         /**
       
   224          * C++ constructor
       
   225          */
       
   226         CCalenDeleteUi( CCalenController& aController );
       
   227 
       
   228         /**
       
   229          * Symbian 2nd phase constructor
       
   230          */
       
   231         void ConstructL();
       
   232 
       
   233     protected:  // Methods derived from MProgressDialogCallback
       
   234         /**
       
   235          * From MProgressDialogCallback
       
   236          * Callback method
       
   237          * called when a dialog is dismissed
       
   238          */
       
   239         void DialogDismissedL( const TInt aButtonId );
       
   240 
       
   241     private:
       
   242 
       
   243         /**
       
   244          * Delete entry using entry local uid
       
   245          */
       
   246         void DeleteEntryL(TCalLocalUid& aEntryLocalUid, TInt aColId );
       
   247 
       
   248         /**
       
   249          * Displays wait dialog while deleting marked entries
       
   250          */
       
   251         void DisplayWaitDialogL();
       
   252 
       
   253         /**
       
   254          * Dismiss wait dialog and show information note
       
   255          */
       
   256         void MarkedEntriesDeletedL();
       
   257 
       
   258         /**
       
   259          * Handles launching of the delete entries list query 
       
   260          */
       
   261         void HandleDeleteAllEntriesL();
       
   262 
       
   263     private: // data
       
   264 
       
   265         CEikonEnv* iEikEnv;
       
   266         CAknWaitDialog* iWaitDialog;
       
   267 
       
   268         TBool iIsDeleting; // True, if asynchronous delete is running
       
   269         TTime iStartTime;
       
   270         TTime iEndTime;
       
   271         // Confirmation note id is stored here. Note is shown when asynchronous
       
   272         // delete completes.
       
   273         TInt iConfirmationNoteId;
       
   274         CCalenGlobalData* iGlobalData;
       
   275         CCalenController& iController;
       
   276 
       
   277         // Stored command if the entry view
       
   278         // needs to constructed asyncronously
       
   279         TCalenCommand iStoredCommand;
       
   280         TInt iMutlipleContextIdsCount;
       
   281         TBool iMoreEntriesToDelete;
       
   282         TBool iDisplayQuery;
       
   283         TInt iEntriesToDelete;
       
   284         TInt iToShowDeleteNote;
       
   285         TInt iNumberOfCalendars;
       
   286         
       
   287         RArray<TInt> iDeleteColIds;
       
   288         CalCommon::TCalTimeRange *iDelAllRange;
       
   289 
       
   290     };
       
   291 
       
   292 #endif // CALENDELETEUI_H
       
   293 
       
   294 // End of File