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