93 0, 0, 0, 0, 0); |
95 0, 0, 0, 0, 0); |
94 TDateTime endTime = TDateTime( |
96 TDateTime endTime = TDateTime( |
95 endDateArray[0], static_cast<TMonth>(endDateArray[1]), |
97 endDateArray[0], static_cast<TMonth>(endDateArray[1]), |
96 0, 0, 0, 0, 0); |
98 0, 0, 0, 0, 0); |
97 |
99 |
98 startDate.SetTimeLocalL(startTime); |
100 startDate.SetTimeUtcL(startTime); |
99 endDate.SetTimeLocalL(endTime); |
101 endDate.SetTimeUtcL(endTime); |
100 CalCommon::TCalTimeRange searchTimeRange(startDate, startDate); |
102 CalCommon::TCalTimeRange searchTimeRange(startDate, endDate); |
101 |
103 |
102 CCalChangeNotificationFilter* filter = 0; |
104 CCalChangeNotificationFilter* filter = 0; |
103 filter = CCalChangeNotificationFilter::NewL( |
105 filter = CCalChangeNotificationFilter::NewL( |
104 EChangeEntryAll, true, searchTimeRange); |
106 MCalChangeCallBack2::EChangeEntryAll, true, searchTimeRange); |
105 |
107 |
106 iCalSession->StartChangeNotification(*this, *filter); |
108 iCalSession->StartChangeNotification(*this, *filter); |
107 |
109 |
108 // Cleanup. |
110 // Cleanup. |
109 delete filter; |
111 delete filter; |
122 return true; |
124 return true; |
123 } |
125 } |
124 |
126 |
125 AgendaUtilPrivate::~AgendaUtilPrivate() |
127 AgendaUtilPrivate::~AgendaUtilPrivate() |
126 { |
128 { |
127 delete iCalEntryView; |
129 if (iCalEntryView && !mIsEntryViewBeingDeleted) { |
128 delete iCalInstanceView; |
130 mIsEntryViewBeingDeleted = true; |
|
131 delete iCalEntryView; |
|
132 iCalEntryView = NULL; |
|
133 } |
|
134 |
|
135 if (iCalInstanceView && !mIsInstanceViewBeingDeleted) { |
|
136 mIsInstanceViewBeingDeleted = true; |
|
137 delete iCalInstanceView; |
|
138 iCalInstanceView = NULL; |
|
139 } |
|
140 |
129 if (iCalSession) { |
141 if (iCalSession) { |
130 iCalSession->StopChangeNotification(); |
142 iCalSession->StopChangeNotification(); |
131 } |
143 } |
132 delete iCalSession; |
144 delete iCalSession; |
133 } |
145 } |
134 |
146 |
135 void AgendaUtilPrivate::Completed(TInt aError) |
147 void AgendaUtilPrivate::Completed(TInt aError) |
136 { |
148 { |
137 iError = aError; |
149 iError = aError; |
138 static bool isInstanceViewDeleted = false; |
|
139 static bool isEntryViewDeleted = false; |
|
140 |
150 |
141 if (mIsDeleting) { |
151 if (mIsDeleting) { |
142 // If deletion was in progress, then it is completed now |
152 // If deletion was in progress, then it is completed now |
143 // emit the signal to the clients. |
153 // emit the signal to the clients. |
144 mIsDeleting = false; |
154 mIsDeleting = false; |
145 emit q->entriesDeleted(iError); |
155 emit q->entriesDeleted(iError); |
146 } |
156 } |
147 |
157 |
148 if (KErrNone != iError) { |
158 if (KErrNone != iError) { |
149 // Something has gone wrong, return |
159 // Something has gone wrong, return |
150 if (iCalEntryView && !isEntryViewDeleted) { |
160 if (iCalEntryView && !mIsEntryViewBeingDeleted) { |
151 isEntryViewDeleted = true; |
161 mIsEntryViewBeingDeleted = true; |
152 delete iCalEntryView; |
162 delete iCalEntryView; |
153 iCalEntryView = NULL; |
163 iCalEntryView = NULL; |
|
164 mIsEntryViewBeingDeleted = false; |
154 } |
165 } |
155 if (iCalInstanceView && !isInstanceViewDeleted) { |
166 if (iCalInstanceView && !mIsInstanceViewBeingDeleted) { |
156 isInstanceViewDeleted = true; |
167 mIsInstanceViewBeingDeleted = true; |
157 delete iCalInstanceView; |
168 delete iCalInstanceView; |
158 iCalInstanceView = NULL; |
169 iCalInstanceView = NULL; |
|
170 mIsInstanceViewBeingDeleted = false; |
159 } |
171 } |
160 return; |
172 return; |
161 } |
173 } |
162 |
174 |
163 if (iCalInstanceView && !mInstanceViewCreated) { |
175 if (iCalInstanceView && !mInstanceViewCreated) { |