--- a/calendarui/controller/inc/calendeleteui.h Thu Aug 19 09:53:43 2010 +0300
+++ b/calendarui/controller/inc/calendeleteui.h Tue Aug 31 15:13:43 2010 +0300
@@ -11,282 +11,246 @@
*
* Contributors:
*
-* Description: Controller class for deleting related UI behavior
+* Description: Controller class for deleting related UI behavior
*
*/
-
#ifndef CALENDELETEUI_H
#define CALENDELETEUI_H
-// INCLUDES
+// System Includes
+#include <QObject>
#include <e32base.h>
-#include <calcommon.h>
-#include <eikenv.h>
-#include <AknWaitDialog.h>
-#include <calprogresscallback.h>
-#include <calencommandhandler.h>
-#include <calennotificationhandler.h>
-#include <calenactionuiutils.h>
+#include <hbdatetimepicker.h>
+#include <agendautil.h>
+
+//User Includes
+#include "calenactionuiutils.h"
+#include "calennotificationhandler.h"
+#include "calencommandhandler.h"
+#include "hb_calencommands.hrh"
// FORWARD DECLARATIONS
-class CAknWaitDialog;
-class CCalenGlobalData;
class CCalenController;
-class CCalInstanceView;
-class CCalInstance;
-class CCalEntry;
-class CCalEntryView;
+class HbAction;
+
+enum TDeleteConfirmationType
+{
+ EDeleteEntry = 1,
+ EDeleteToDo,
+ EDeleteToDos,
+ EDeleteAll,
+ EDeleteEvent
+};
// CLASS DECLARATION
/**
- * CCalenDeleteUi encapsulates deleting related behavior
+ * CalenDeleteUi encapsulates deleting related behavior
* in Calendar application.
*/
-NONSHARABLE_CLASS( CCalenDeleteUi ) : public CBase,
- public MCalProgressCallBack,
- public MCalenNotificationHandler,
- public MCalenCommandHandler,
- public MProgressDialogCallback
+ class CalenDeleteUi : public QObject,
+ public MCalenNotificationHandler,
+ public MCalenCommandHandler
+
{
+ Q_OBJECT
- public: // public API
-
- /**
- * Symbian 1st phase constructor
- * @param aController Reference to CCalenController
- */
- static CCalenDeleteUi* NewL( CCalenController& aController );
+public: // public API
+ /**
+ * Symbian 1st phase constructor
+ * @param aController Reference to CCCalenController
+ */
+ static CalenDeleteUi* NewL(CCalenController& aController );
- /**
- * Destructor
- */
- virtual ~CCalenDeleteUi();
+ /**
+ * Destructor
+ */
+ virtual ~CalenDeleteUi();
- public: // From MCalenCommandHandler
-
- /**
- * Handles key presses.
- *
- * @param aCommand The command Id of the key.
- */
- TBool HandleCommandL( const TCalenCommand& aCommand );
-
- /**
- * Allows extending this API without breaking BC.
- *
- * @param aExtensionUid specifies
- * @return extension of the requested type
- */
- TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
+public: // MCalenCommandHandler
+ /**
+ * Handles action ui commands
+ * @param aCommand Command to be handled
+ */
+ TBool HandleCommandL( const TCalenCommand& aCommand );
- public: // New functions
- /**
- * UI sequence for deleting single entry. Shows UI queries and notes and
- * performs delete. Current entry is taken from Calendar Context
- */
- void DeleteCurrentEntryL();
+public: // New functions
+ /**
+ * UI sequence for deleting single entry. Shows UI queries and notes and
+ * performs delete. Current entry is taken from Calendar Context
+ */
+ void DeleteCurrentEntryL();
- /**
- * UI sequence for deleting all entries. Shows UI queries and notes and
- * performs delete asynchronosuly.
- */
- void DeleteAllEntriesL();
-
- /**
- * UI sequence for deleting entries before given date.
- * Shows UI queries and notes and performs delete asynchronosuly.
- */
- void DeleteEntriesBeforeDateL();
+ /**
+ * UI sequence for deleting all entries. Shows UI queries and notes and
+ * performs delete asynchronosuly.
+ */
+ void DeleteAllEntriesL();
- /**
- * UI sequence for deleting series repeating entry
- * Becasue a ThisAndAll repeat type has already been chosen by user,
- * no repeat query is required. Performs delete asynchronosuly.
- */
- void DeleteThisOrAllL( CalCommon::TRecurrenceRange aRepeatType );
-
- public: // from MCalenNotificationHandler
- /**
- * Handle notifications
- * @param aNotification Notification to be handled
- */
- void HandleNotification(const TCalenNotification aNotification );
-
- private: // From MCalProgressCallBack
- /**
- * From MCalProgressCallBack
- */
- void Completed( TInt aError );
-
- /**
- * From MCalProgressCallBack
- */
- TBool NotifyProgress();
-
- /**
- * From MCalProgreeCallBack
- */
- void Progress( TInt aPercentageCompleted );
+ /**
+ * UI sequence for deleting entries before given date.
+ * Shows UI queries and notes and performs delete asynchronosuly.
+ */
+ void DeleteEntriesBeforeDateL();
+
+ /**
+ * UI sequence for deleting series repeating entry
+ * Becasue a ThisAndAll repeat type has already been chosen by user,
+ * no repeat query is required. Performs delete asynchronosuly.
+ */
+ void DeleteThisOrAllL( AgendaUtil::RecurrenceRange aRepeatType );
+
+public: // from MCalenNotificationHandler
+ /**
+ * Handle notifications
+ * @param aNotification Notification to be handled
+ */
+ void HandleNotification(const TCalenNotification aNotification );
- private: // own methods
- /**
- * Handles deleting all entries in time range from aFirstDay to aLastDay.
- * Shows wait notification and given confirmation notifications.
- */
- void HandleDeleteMultipleEventsL( const TTime& aFirstDay,
- const TTime& aLastDay,
- TInt aConfNoteId );
+private: // own methods
+ /**
+ * Handles deleting all entries in time range from aFirstDay to aLastDay.
+ * Shows wait notification and given confirmation notifications.
+ */
+ void HandleDeleteMultipleEventsL( const QDateTime& aFirstDay,
+ const QDateTime& aLastDay,
+ int aConfNoteId );
- /**
- * Delete entries from given range
- */
- void DeleteDayRangeL( const TTime& aStart, const TTime& aEnd );
+ /**
+ * Delete entries from given range
+ */
+ void DeleteDayRangeL( const QDateTime& aStart, const QDateTime& aEnd );
- /**
- * Delete entries than end at given midnight.
- * This is needed when deleting multiple entries, to handle
- * e.g all-day notes that extends to next day's midnight.
- */
- void DeleteEntriesEndingAtMidnightL( TTime aMidnight );
+ /**
+ * Delete entries than end at given midnight.
+ * This is needed when deleting multiple entries, to handle
+ * e.g all-day notes that extends to next day's midnight.
+ */
+ void deleteEntriesEndingAtMidnight( QDateTime aMidnight );
- /**
- * just a wrapper for leave
- */
- void DoCompletedL( TInt aFirstPassError );
-
- /**
- * Delete entry by passing CCalEntryView and CCalEntry
- * Will query user for confirmation before deletion
- * @return ETrue user confirms to delete EFalse otherwise
- */
- TBool DeleteEntryL( CCalEntryView* aEntryView, CCalEntry* aEntry );
+ /**
+ * Delete entry without querying the user
+ */
+ TBool DeleteEntryWithoutQueryL();
+
+ /**
+ * Delete the given entry. Ask the user whether to delete the
+ * instance or the entire series.
+ */
+ void DeleteSingleInstanceL( AgendaEntry& aInstance );
- /**
- * Delete entry without querying the user
- */
- TBool DeleteEntryWithoutQueryL();
-
- /**
- * Delete the given entry. Ask the user whether to delete the
- * instance or the entire series.
- */
- TBool DeleteSingleInstanceL( CCalInstance* aInstance );
-
- /**
- * Delete the given entry, using aRepeatType to determine
- * whether to delete the instance or the entire series.
- */
- TBool DeleteSingleInstanceL( CCalInstance* aInstance,
- CalCommon::TRecurrenceRange aRepeatType );
-
- /**
- * Show the confirmation query with confirmation type and number of entries this query is for
- * @param aType Type of query: EDeleteEntry/ EDeleteTodo/ EDeleteTodos/ EDeleteAll
- */
- TInt ShowDeleteConfirmationQueryL( const CalenActionUiUtils::TDeleteConfirmationType aType,
- const TInt aCount=0 );
-
- /**
- * Delete single instance.
- * @param aInstance Pointer to the instance to be deleted
- * @param aHasRepeatType Whether or not the instance is repeating
- * @param aRepeatType Repeat type choosen to apply on delete
- * @return ETrue is user confirms to delete, EFalse otherwise
- */
- TBool DoDeleteSingleInstanceL( CCalInstance* aInstance,
- TBool aHasRepeatType,
- CalCommon::TRecurrenceRange aRepeatType );
-
- /**
- * Attempt to delete the instance using the Meeting Request utilities,
- * if MR viewers is enabled.
- * @param aInstance Pointer to the instance to be delete
- * @param aRepeatType Repeat Type choosen to apply on delete
- * @return ETrue if user confirms to delete, EFalse otherwise
- */
- TBool TryDeleteWithMrUtilsL( CCalInstance* aInstance,
- CalCommon::TRecurrenceRange aRepeatType );
-
- /**
- * Leaving function, handle ECalenNotifyViewCreated
- */
- void HandleECalenNotifyViewCreatedL();
-
- /**
- * Multiple entries delete query
- */
- TInt ShowMultipleEntriesDeleteQueryL(TInt aCount);
-
- private: // own methods
- /**
- * C++ constructor
- */
- CCalenDeleteUi( CCalenController& aController );
+ /**
+ * Delete the given entry, using aRepeatType to determine
+ * whether to delete the instance or the entire series.
+ */
+ void DeleteSingleInstanceL( AgendaEntry& aInstance,
+ AgendaUtil::RecurrenceRange aRepeatType );
+
+ /**
+ * Delete single instance.
+ * @param aInstance Pointer to the instance to be deleted
+ * @param aHasRepeatType Whether or not the instance is repeating
+ * @param aRepeatType Repeat type choosen to apply on delete
+ * @return ETrue is user confirms to delete, EFalse otherwise
+ */
+ void DoDeleteSingleInstanceL( AgendaEntry& aInstance,
+ bool aHasRepeatType,
+ AgendaUtil::RecurrenceRange aRepeatType );
+
+ /**
+ * Leaving function, handle ECalenNotifyViewCreated
+ */
+ void HandleECalenNotifyViewCreatedL();
+
+ /**
+ * Get the date from user.
+ */
+ void dateQuery();
+
+ /**
+ * Shows a confirmation query to the user if
+ * he/she wants to delete the particular instance
+ * or the entire series of a repeating entry
+ */
+ void showRepeatingEntryDeleteQuery();
+
+ /**
+ * Shows a confirmation query to the user if
+ * he/she wants to delete instance/instances
+ */
+ void showDeleteQuery(const TDeleteConfirmationType type,
+ const int count = 0);
+
+private: // own methods
+ /**
+ * C++ constructor
+ */
+ CalenDeleteUi( CCalenController& aController, QObject *parent = 0 );
+
+ /**
+ * Symbian 2nd phase constructor
+ */
+ void ConstructL();
- /**
- * Symbian 2nd phase constructor
- */
- void ConstructL();
-
- protected: // Methods derived from MProgressDialogCallback
- /**
- * From MProgressDialogCallback
- * Callback method
- * called when a dialog is dismissed
- */
- void DialogDismissedL( const TInt aButtonId );
-
- private:
+protected: // Methods derived from MProgressDialogCallback
+ /**
+ * From MProgressDialogCallback
+ * Callback method
+ * called when a dialog is dismissed
+ */
+ void DialogDismissedL( const int aButtonId );
- /**
- * Delete entry using entry local uid
- */
- void DeleteEntryL(TCalLocalUid& aEntryLocalUid, TInt aColId );
+public slots:
- /**
- * Displays wait dialog while deleting marked entries
- */
- void DisplayWaitDialogL();
-
- /**
- * Dismiss wait dialog and show information note
- */
- void MarkedEntriesDeletedL();
+ void doCompleted( int aFirstPassError );
+ void handleDateQuery(HbAction* action);
+ void handleDeletion(HbAction* action);
+ void handleDeleteCancel();
+
+private slots:
+ void handleRepeatedEntryDelete(int index);
+ void entryDeleted(ulong id);
- /**
- * Handles launching of the delete entries list query
- */
- void HandleDeleteAllEntriesL();
-
- private: // data
-
- CEikonEnv* iEikEnv;
- CAknWaitDialog* iWaitDialog;
-
- TBool iIsDeleting; // True, if asynchronous delete is running
- TTime iStartTime;
- TTime iEndTime;
- // Confirmation note id is stored here. Note is shown when asynchronous
- // delete completes.
- TInt iConfirmationNoteId;
- CCalenGlobalData* iGlobalData;
- CCalenController& iController;
-
- // Stored command if the entry view
- // needs to constructed asyncronously
- TCalenCommand iStoredCommand;
- TInt iMutlipleContextIdsCount;
- TBool iMoreEntriesToDelete;
- TBool iDisplayQuery;
- TInt iEntriesToDelete;
- TInt iToShowDeleteNote;
- TInt iNumberOfCalendars;
-
- RArray<TInt> iDeleteColIds;
- CalCommon::TCalTimeRange *iDelAllRange;
-
+private:
+
+ /**
+ * Delete entry using entry local uid
+ */
+ void DeleteEntryL(ulong& aEntryLocalUid);
+
+ /**
+ * Displays wait dialog while deleting marked entries
+ */
+ void DisplayWaitDialogL();
+
+ /**
+ * Dismiss wait dialog and show information note
+ */
+ void MarkedEntriesDeletedL();
+
+private: // data
+
+ bool iIsDeleting; // True, if asynchronous delete is running
+ QDateTime iStartTime;
+ QDateTime iEndTime;
+ HbDateTimePicker *mDatePicker;
+ HbAction *mDeleteAction;
+ HbAction *mCancelAction;
+ // Confirmation note id is stored here. Note is shown when asynchronous
+ // delete completes.
+ int iConfirmationNoteId;
+ CCalenController& iController;
+ TCalenCommandId mDeleteCommand;
+ AgendaUtil::RecurrenceRange mRecurrenceRange;
+
+ // Stored command if the entry view
+ // needs to constructed asyncronously
+ TCalenCommand iStoredCommand;
+ int iMutlipleContextIdsCount;
+ bool iMoreEntriesToDelete;
+ bool iDisplayQuery;
+ int iEntriesToDelete;
};
#endif // CALENDELETEUI_H