110 // |
110 // |
111 CCalenDbField::~CCalenDbField() |
111 CCalenDbField::~CCalenDbField() |
112 { |
112 { |
113 TRACE_ENTRY_POINT; |
113 TRACE_ENTRY_POINT; |
114 |
114 |
|
115 if( iAsyncDBquery ) |
|
116 { |
|
117 iAsyncDBquery->Cancel(); |
|
118 delete iAsyncDBquery; |
|
119 iAsyncDBquery = NULL; |
|
120 } |
|
121 |
115 delete iDbNamesArrayText; |
122 delete iDbNamesArrayText; |
116 delete iDbNamesArray; |
123 delete iDbNamesArray; |
117 delete iDbNamesTextValues; |
124 delete iDbNamesTextValues; |
118 delete iCalendarFileName; |
125 delete iCalendarFileName; |
119 |
126 |
202 |
209 |
203 TRACE_EXIT_POINT; |
210 TRACE_EXIT_POINT; |
204 } |
211 } |
205 |
212 |
206 // ----------------------------------------------------------------------------- |
213 // ----------------------------------------------------------------------------- |
|
214 // CCalenDbField::SetDataToEditorL |
|
215 // update data in form |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 void CCalenDbField::SetDataToEditorL(const TCalCollectionId& aColId) |
|
219 { |
|
220 TRACE_ENTRY_POINT; |
|
221 //Get MultipleDbInfo array |
|
222 RPointerArray<CCalCalendarInfo> calendarInfoList; |
|
223 iServices->GetAllCalendarInfoL(calendarInfoList); |
|
224 CleanupClosePushL(calendarInfoList); |
|
225 |
|
226 TInt index = KErrNotFound; |
|
227 |
|
228 HBufC* calendarFileName= iServices->GetCalFileNameForCollectionId(aColId).AllocLC(); |
|
229 index = calendarInfoList.Find(*calendarFileName, CCalenDbField::CalendarInfoNameIdentifierL); |
|
230 CleanupStack::PopAndDestroy(calendarFileName); |
|
231 |
|
232 if (KErrNotFound == index) |
|
233 { |
|
234 iDbNamesTextValues->SetCurrentValueIndex(0); |
|
235 } |
|
236 else |
|
237 { |
|
238 iDbNamesTextValues->SetCurrentValueIndex(index); |
|
239 } |
|
240 iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL( |
|
241 IsCalendarEdited(), iPreviousColId, iCurrentColId); |
|
242 |
|
243 CleanupStack::PopAndDestroy(&calendarInfoList); |
|
244 |
|
245 TRACE_EXIT_POINT; |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
207 // CCalenDbField::HandleControlStateChangeL |
249 // CCalenDbField::HandleControlStateChangeL |
208 // (other items were commented in a header). |
250 // (other items were commented in a header). |
209 // ----------------------------------------------------------------------------- |
251 // ----------------------------------------------------------------------------- |
210 // |
252 // |
211 void CCalenDbField::HandleControlStateChangeL( TInt aControlId ) |
253 void CCalenDbField::HandleControlStateChangeL( TInt aControlId ) |
218 { |
260 { |
219 TBool continueOnError = EFalse; |
261 TBool continueOnError = EFalse; |
220 ReadDataFromFormL( continueOnError ); |
262 ReadDataFromFormL( continueOnError ); |
221 iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL(IsCalendarEdited() |
263 iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL(IsCalendarEdited() |
222 ,iPreviousColId,iCurrentColId); |
264 ,iPreviousColId,iCurrentColId); |
223 //Check the child entries for the repeated entry |
|
224 //The entry which is changing the calendar having any childs |
|
225 //show this information note to the user. |
|
226 CCalEntry& originalEntry = iUnifiedEditor.EditorDataHandler().Entry(); |
|
227 RPointerArray<CCalEntry> childEntries; |
|
228 CleanupClosePushL(childEntries); |
|
229 iServices->EntryViewL(iPreviousColId)->FetchL(originalEntry.UidL(), childEntries); |
|
230 if(IsCalendarEdited() && (childEntries.Count() > 1)) |
|
231 { |
|
232 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
233 if( !dlg->ExecuteLD( R_CALEN_DB_CHANGE_QUERY ) ) |
|
234 { |
|
235 iCurrentColId = iPreviousColId; |
|
236 SetDataToEditorL(); |
|
237 iUnifiedEditor.UpdateFormL(); |
|
238 } |
|
239 } |
|
240 CleanupStack::PopAndDestroy( &childEntries ); |
|
241 |
265 |
|
266 TCallBack callback(DoAsyncShowChangeDBQueryL,this); |
|
267 iAsyncDBquery = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard); |
|
268 iAsyncDBquery->CallBack(); |
242 break; |
269 break; |
243 } |
270 } |
244 default: |
271 default: |
245 break; |
272 break; |
246 } |
273 } |
247 |
274 |
248 TRACE_EXIT_POINT; |
275 TRACE_EXIT_POINT; |
|
276 } |
|
277 |
|
278 // ---------------------------------------------------------------------------- |
|
279 // CallBackForShowinginfonote |
|
280 // (other items were commented in a header). |
|
281 // ---------------------------------------------------------------------------- |
|
282 // |
|
283 TInt CCalenDbField::DoAsyncShowChangeDBQueryL(TAny* aThisPtr) |
|
284 { |
|
285 TRACE_ENTRY_POINT |
|
286 CCalenDbField* self = static_cast<CCalenDbField*>(aThisPtr); |
|
287 if(self) |
|
288 { |
|
289 self->ShowChangeDBQueryL(); |
|
290 } |
|
291 TRACE_EXIT_POINT |
|
292 return 0; |
249 } |
293 } |
250 |
294 |
251 // ----------------------------------------------------------------------------- |
295 // ----------------------------------------------------------------------------- |
252 // CCalenDbField::ReadDataFromFormL |
296 // CCalenDbField::ReadDataFromFormL |
253 // (other items were commented in a header). |
297 // (other items were commented in a header). |
353 TRACE_ENTRY_POINT; |
397 TRACE_ENTRY_POINT; |
354 TPtrC calendarFileName = aInfoItem.FileNameL(); |
398 TPtrC calendarFileName = aInfoItem.FileNameL(); |
355 TRACE_EXIT_POINT; |
399 TRACE_EXIT_POINT; |
356 return (!calendarFileName.CompareF(*aName)); |
400 return (!calendarFileName.CompareF(*aName)); |
357 } |
401 } |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CCalenDbField::ShowChangeDBQueryL |
|
404 // (other items were commented in a header). |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 void CCalenDbField::ShowChangeDBQueryL() |
|
408 { |
|
409 |
|
410 //Check the child entries for the repeated entry |
|
411 //The entry which is changing the calendar having any childs |
|
412 //show this information note to the user. |
|
413 CCalEntry& originalEntry = iUnifiedEditor.EditorDataHandler().Entry(); |
|
414 RPointerArray<CCalEntry> childEntries; |
|
415 CleanupClosePushL(childEntries); |
|
416 iServices->EntryViewL(iPreviousColId)->FetchL(originalEntry.UidL(), childEntries); |
|
417 if(IsCalendarEdited() && (childEntries.Count() > 1)) |
|
418 { |
|
419 TCalCollectionId currentId = iCurrentColId; |
|
420 SetDataToEditorL(); |
|
421 iUnifiedEditor.UpdateFormL(); |
|
422 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
423 if( dlg->ExecuteLD( R_CALEN_DB_CHANGE_QUERY ) ) |
|
424 { |
|
425 iCurrentColId = currentId; |
|
426 SetDataToEditorL(iCurrentColId); |
|
427 iUnifiedEditor.UpdateFormL(); |
|
428 } |
|
429 } |
|
430 CleanupStack::PopAndDestroy( &childEntries ); |
|
431 } |
358 // End of File |
432 // End of File |