|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Implementation for ESMR base task |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrdeletefromdbmrtask.h" |
|
20 |
|
21 #include <calentry.h> |
|
22 #include <calinstance.h> |
|
23 #include <calinstanceview.h> |
|
24 //<cmail> |
|
25 #include "mesmrutilstombsext.h" |
|
26 //</cmail> |
|
27 #include "cesmrcaldbmgr.h" |
|
28 #include "mesmrmeetingrequestentry.h" |
|
29 #include "esmrentryhelper.h" |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CESMRDeleteMRFromDbTask::CESMRDeleteMRFromDbTask |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CESMRDeleteMRFromDbTask::CESMRDeleteMRFromDbTask( |
|
38 MESMRCalDbMgr& aCalDbMgr, |
|
39 MESMRMeetingRequestEntry& aEntry, |
|
40 CMRMailboxUtils& aMRMailboxUtils ) |
|
41 : CESMRTaskBase( aCalDbMgr, aEntry, aMRMailboxUtils ) |
|
42 { |
|
43 FUNC_LOG; |
|
44 //do nothing |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CESMRDeleteMRFromDbTask::~CESMRDeleteMRFromDbTask |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CESMRDeleteMRFromDbTask::~CESMRDeleteMRFromDbTask() |
|
52 { |
|
53 FUNC_LOG; |
|
54 //do nothing |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CESMRDeleteMRFromDbTask::NewL |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CESMRDeleteMRFromDbTask* CESMRDeleteMRFromDbTask::NewL( |
|
62 MESMRCalDbMgr& aCalDbMgr, |
|
63 MESMRMeetingRequestEntry& aEntry, |
|
64 CMRMailboxUtils& aMRMailboxUtils ) |
|
65 { |
|
66 FUNC_LOG; |
|
67 CESMRDeleteMRFromDbTask* self = |
|
68 new (ELeave) CESMRDeleteMRFromDbTask( |
|
69 aCalDbMgr, |
|
70 aEntry, |
|
71 aMRMailboxUtils ); |
|
72 |
|
73 CleanupStack::PushL(self); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop(self); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CESMRDeleteMRFromDbTask::ConstructL |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CESMRDeleteMRFromDbTask::ConstructL() |
|
84 { |
|
85 FUNC_LOG; |
|
86 BaseConstructL(); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CESMRDeleteMRFromDbTask::ExecuteTaskL |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CESMRDeleteMRFromDbTask::ExecuteTaskL() |
|
94 { |
|
95 FUNC_LOG; |
|
96 // Store to calendar DB |
|
97 DeleteEntryFromDbL(); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CESMRDeleteMRFromDbTask::DeleteEntryFromDbL |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CESMRDeleteMRFromDbTask::DeleteEntryFromDbL() |
|
105 { |
|
106 FUNC_LOG; |
|
107 |
|
108 MESMRCalDbMgr& calDb = CalDbMgr(); |
|
109 MESMRMeetingRequestEntry& mrEntry = ESMREntry(); |
|
110 CCalEntry& entry = mrEntry.Entry(); |
|
111 |
|
112 if ( mrEntry.IsSyncObjectPresent() ) |
|
113 { |
|
114 } |
|
115 else |
|
116 { |
|
117 CCalEntry* entryToDeleted = NULL; |
|
118 |
|
119 |
|
120 if ( mrEntry.IsRecurrentEventL() && |
|
121 (MESMRCalEntry::EESMRThisOnly == mrEntry.RecurrenceModRule()) && |
|
122 mrEntry.IsOpenedFromMail() ) |
|
123 { |
|
124 entryToDeleted = mrEntry.RemoveInstanceFromSeriesL(); |
|
125 CleanupStack::PushL( entryToDeleted ); |
|
126 calDb.StoreEntryL( *entryToDeleted, ETrue ); |
|
127 |
|
128 } |
|
129 else |
|
130 { |
|
131 entryToDeleted = mrEntry.ValidateEntryL(); |
|
132 CleanupStack::PushL( entryToDeleted ); |
|
133 // <cmail> |
|
134 TRAPD(err, calDb.DeleteEntryCondL( *entryToDeleted ) ); |
|
135 if ( err == KErrNotFound ) |
|
136 { |
|
137 // If meeting request to be deleted is not found from the calendar |
|
138 // Do not care about error. This is just for avoiding leave |
|
139 } |
|
140 // </cmail> |
|
141 } |
|
142 |
|
143 CleanupStack::PopAndDestroy( entryToDeleted ); |
|
144 entryToDeleted = NULL; |
|
145 } |
|
146 |
|
147 } |
|
148 |
|
149 // EOF |
|
150 |