1 /* |
|
2 * Copyright (c) 2003 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: notepad database |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <sysutil.h> |
|
20 |
|
21 #include <txtetext.h> |
|
22 #include "nsmlnotepadDatabase.h" |
|
23 #include <nsmlnotepaddatastoreformat.rsg> |
|
24 #include <nsmlconstants.h> |
|
25 |
|
26 #include <calentryview.h> |
|
27 #include <calentry.h> |
|
28 #include <calinstance.h> |
|
29 #include <calinstanceview.h> |
|
30 #include <calsession.h> |
|
31 #include <CalenInterimUtils2.h> |
|
32 |
|
33 #include "nsmlnotepadlogging.h" |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CNSmlNotepadDatabase::NewL |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CNSmlNotepadDatabase* CNSmlNotepadDatabase::NewL() |
|
40 { |
|
41 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::NewL(): begin"); |
|
42 |
|
43 CNSmlNotepadDatabase *instance = new(ELeave) CNSmlNotepadDatabase(); |
|
44 CleanupStack::PushL(instance); |
|
45 instance->ConstructL(); |
|
46 CleanupStack::Pop(instance); |
|
47 |
|
48 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::NewL(): end"); |
|
49 return instance; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CNSmlNotepadDatabase::~CNSmlNotepadDatabase() |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CNSmlNotepadDatabase::~CNSmlNotepadDatabase() |
|
57 { |
|
58 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): begin"); |
|
59 |
|
60 CloseAgendaSessions(); |
|
61 |
|
62 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): end"); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CNSmlNotepadDatabase::CNSmlNotepadDatabase() |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CNSmlNotepadDatabase::CNSmlNotepadDatabase() |
|
70 { |
|
71 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::CNSmlNotepadDatabase(): begin"); |
|
72 |
|
73 iOpened = EFalse; |
|
74 |
|
75 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::CNSmlNotepadDatabase(): end"); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CNSmlNotepadDatabase::ConstructL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CNSmlNotepadDatabase::ConstructL() |
|
83 { |
|
84 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ConstructL: begin"); |
|
85 |
|
86 // Instantiate the Session variable |
|
87 iSession = CCalSession::NewL(); |
|
88 |
|
89 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ConstructL: end"); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // TInt CNSmlNotepadDatabase::OpenL(const TDesC& aStoreName) |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CNSmlNotepadDatabase::OpenL(const TDesC& aStoreName) |
|
97 { |
|
98 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::OpenL(): begin"); |
|
99 CloseAgendaSessions(); |
|
100 |
|
101 TInt err = KErrNone; |
|
102 iSession = CCalSession::NewL(); |
|
103 |
|
104 TRAP( err,iSession->OpenL( aStoreName ) ); |
|
105 if(err == KErrNotFound) |
|
106 { |
|
107 iSession->CreateCalFileL( aStoreName ); |
|
108 iSession->OpenL( aStoreName ); |
|
109 } |
|
110 else if( err != KErrNone ) |
|
111 { |
|
112 CloseAgendaSessions(); |
|
113 User::Leave(err); |
|
114 } |
|
115 |
|
116 iEntryView = CCalEntryView::NewL(*iSession); |
|
117 iInstanceView = CCalInstanceView::NewL(*iSession); |
|
118 |
|
119 if(iEntryView && iInstanceView) |
|
120 { |
|
121 iOpened = ETrue; |
|
122 } |
|
123 else |
|
124 { |
|
125 CloseAgendaSessions(); |
|
126 User::LeaveIfError(KErrNotFound); |
|
127 } |
|
128 |
|
129 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::OpenL(): end"); |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CNSmlNotepadDatabase::AddNoteL |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CNSmlNotepadDatabase::AddNoteL(CNpdItem& aNote, TInt &aKey) |
|
137 { |
|
138 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): begin"); |
|
139 |
|
140 TInt successCount = 0; |
|
141 |
|
142 CCalenInterimUtils2* interimUtils = CCalenInterimUtils2::NewL(); |
|
143 CleanupStack::PushL(interimUtils); |
|
144 |
|
145 HBufC8* guid = interimUtils->GlobalUidL(); |
|
146 CleanupStack::PopAndDestroy(interimUtils); |
|
147 |
|
148 CleanupStack::PushL(guid); |
|
149 CCalEntry* entry = CCalEntry::NewL(CCalEntry::ENote, guid, |
|
150 CCalEntry::EMethodNone, 0); |
|
151 CleanupStack::Pop(guid); |
|
152 |
|
153 CleanupStack::PushL(entry); |
|
154 |
|
155 // set the description |
|
156 TDesC* noteContent(aNote.Content()); |
|
157 entry->SetDescriptionL(*noteContent); |
|
158 |
|
159 // store the entry in to calendar file |
|
160 RPointerArray<CCalEntry> array; |
|
161 CleanupRPtrArrayPushL(array); |
|
162 |
|
163 array.AppendL(entry); |
|
164 CleanupStack::Pop(entry); |
|
165 iEntryView->StoreL(array, successCount); |
|
166 |
|
167 if(successCount) |
|
168 { |
|
169 HBufC* content = HBufC::NewL(entry->DescriptionL().Length()); |
|
170 content->Des().Copy(entry->DescriptionL()); |
|
171 aNote.Set(entry->LocalUidL(),entry->LastModifiedDateL().TimeUtcL(), content); |
|
172 aKey = entry->LocalUidL(); |
|
173 CleanupStack::PopAndDestroy(&array); |
|
174 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): inside if(successCount) after array"); |
|
175 } |
|
176 else |
|
177 { |
|
178 User::Leave(KErrGeneral); |
|
179 } |
|
180 |
|
181 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): end"); |
|
182 |
|
183 User::Leave(KErrNone); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CNSmlNotepadDatabase::DeleteNoteL |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CNSmlNotepadDatabase::DeleteNoteL(const TInt aKey) |
|
191 { |
|
192 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::DeleteNoteL(): begin"); |
|
193 |
|
194 CCalEntry* entryTobeDeleted(NULL); |
|
195 entryTobeDeleted = iEntryView->FetchL(aKey); |
|
196 if(entryTobeDeleted) |
|
197 { |
|
198 CleanupStack::PushL(entryTobeDeleted); |
|
199 iEntryView->DeleteL(*entryTobeDeleted); |
|
200 CleanupStack::Pop(entryTobeDeleted); |
|
201 } |
|
202 |
|
203 delete entryTobeDeleted; |
|
204 entryTobeDeleted = NULL; |
|
205 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::DeleteNoteL(): end"); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CNSmlNotepadDatabase::Close |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void CNSmlNotepadDatabase::Close() // can be deprecated ???? |
|
213 { |
|
214 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::Close(): begin"); |
|
215 iOpened = EFalse; |
|
216 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::Close(): end"); |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CNSmlNotepadDatabase::GetNoteL |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 void CNSmlNotepadDatabase::GetNoteL(const TInt aKey, CNpdItem& aItem) |
|
224 { |
|
225 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): begin"); |
|
226 TInt err(KErrNone); |
|
227 if(!iOpened) |
|
228 { |
|
229 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): not opened"); |
|
230 User::Leave(KErrNotReady); |
|
231 } |
|
232 |
|
233 if(aKey) |
|
234 { |
|
235 CCalEntry* entryTobeFetched(NULL); |
|
236 entryTobeFetched = iEntryView->FetchL(aKey); |
|
237 if(entryTobeFetched) |
|
238 { |
|
239 CleanupStack::PushL(entryTobeFetched); |
|
240 HBufC* content = HBufC::NewL(entryTobeFetched->DescriptionL().Length()); |
|
241 content->Des().Copy(entryTobeFetched->DescriptionL()); |
|
242 |
|
243 aItem.Set(aKey, entryTobeFetched->LastModifiedDateL().TimeUtcL(), content); |
|
244 |
|
245 //CleanupStack::Pop(aItem); |
|
246 CleanupStack::PopAndDestroy(entryTobeFetched); |
|
247 } |
|
248 else |
|
249 { |
|
250 delete entryTobeFetched; |
|
251 entryTobeFetched = NULL; |
|
252 } |
|
253 } |
|
254 |
|
255 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): end"); |
|
256 User::Leave(err); |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CNSmlNotepadDatabase::UpdateNoteL |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 void CNSmlNotepadDatabase::UpdateNoteL(const TInt aKey, CNpdItem& aItem) |
|
264 { |
|
265 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): begin"); |
|
266 |
|
267 if(!iOpened) |
|
268 { |
|
269 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): not ready"); |
|
270 User::Leave(KErrNotReady); |
|
271 } |
|
272 |
|
273 RPointerArray<CCalEntry> array; |
|
274 CleanupRPtrArrayPushL(array); |
|
275 |
|
276 // fetch the created note using the localuid |
|
277 CCalEntry* entryTobeUpdated(NULL); |
|
278 entryTobeUpdated = iEntryView->FetchL(aKey); |
|
279 if(entryTobeUpdated) |
|
280 { |
|
281 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): entry found"); |
|
282 } |
|
283 else |
|
284 { |
|
285 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): entry not found"); |
|
286 User::Leave(KErrNotFound); |
|
287 } |
|
288 CleanupStack::PushL(entryTobeUpdated); |
|
289 |
|
290 // update the description |
|
291 HBufC* content = HBufC::NewL(aItem.Content()->Length()); |
|
292 content = aItem.Content(); |
|
293 |
|
294 entryTobeUpdated->SetDescriptionL(*content); |
|
295 |
|
296 array.AppendL(entryTobeUpdated); |
|
297 CleanupStack::Pop(entryTobeUpdated); |
|
298 TBool success(EFalse); |
|
299 // update the entry |
|
300 iEntryView->UpdateL(array, success); |
|
301 |
|
302 if(success) |
|
303 { |
|
304 aItem.SetModified(entryTobeUpdated->LastModifiedDateL().TimeUtcL()); |
|
305 CleanupStack::PopAndDestroy(&array); |
|
306 } |
|
307 else |
|
308 { |
|
309 User::Leave(KErrGeneral); |
|
310 } |
|
311 |
|
312 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): end"); |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CNSmlNotepadDatabase::ResetL |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 TInt CNSmlNotepadDatabase::ResetL() |
|
320 { |
|
321 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin"); |
|
322 |
|
323 TInt err(KErrNone); |
|
324 CArrayPtr<CNpdItem>* arrNpdItem = NULL; |
|
325 |
|
326 // Fetch all the available notes from the db |
|
327 arrNpdItem = FetchItemsLC(); |
|
328 |
|
329 // Delete the Notes |
|
330 for( TInt count = 0; count < arrNpdItem->Count(); count++ ) |
|
331 { |
|
332 CCalEntry* entryTobeDeleted(NULL); |
|
333 entryTobeDeleted = iEntryView->FetchL( arrNpdItem->At(count)->Key() ); |
|
334 if(entryTobeDeleted) |
|
335 { |
|
336 CleanupStack::PushL(entryTobeDeleted); |
|
337 iEntryView->DeleteL(*entryTobeDeleted); |
|
338 CleanupStack::Pop(entryTobeDeleted); |
|
339 } |
|
340 delete entryTobeDeleted; |
|
341 entryTobeDeleted = NULL; |
|
342 } |
|
343 CleanupStack::PopAndDestroy(arrNpdItem); |
|
344 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin"); |
|
345 return err; |
|
346 } |
|
347 |
|
348 // ----------------------------------------------------------------------------- |
|
349 // CNSmlNotepadDatabase::IsOpen |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 TBool CNSmlNotepadDatabase::IsOpen() |
|
353 { |
|
354 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::IsOpen(): begin"); |
|
355 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::IsOpen(): end"); |
|
356 return iOpened; |
|
357 } |
|
358 |
|
359 |
|
360 // ------------------------------------------------------------------------------------------------ |
|
361 // CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText, |
|
362 // ------------------------------------------------------------------------------------------------ |
|
363 CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText, |
|
364 TInt* aKey) |
|
365 { |
|
366 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): begin") ; |
|
367 |
|
368 CArrayPtr<CNpdItem>* res = new (ELeave) CArrayPtrFlat<CNpdItem> (8); |
|
369 CleanupPtrArrayPushL(res); |
|
370 |
|
371 if(!aKey) |
|
372 { |
|
373 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In aKey case"); |
|
374 RPointerArray<CCalInstance> array; |
|
375 CleanupRPtrArrayPushL(array); |
|
376 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After cleaupstack"); |
|
377 |
|
378 TCalTime startDate; |
|
379 startDate.SetTimeLocalL(TDateTime(1900, EJanuary, 1, 0, 0, 0, 0)); |
|
380 TCalTime endDate; |
|
381 endDate.SetTimeLocalL(TDateTime(2100, EJanuary, 30, 0, 0, 0, 0)); |
|
382 CalCommon::TCalTimeRange timeRange(startDate, endDate); |
|
383 |
|
384 iInstanceView->FindInstanceL(array,CalCommon::EIncludeNotes, timeRange); |
|
385 CNpdItem* entry = NULL; |
|
386 TInt i = 0; |
|
387 |
|
388 while (i < array.Count()) |
|
389 { |
|
390 entry = CNpdItem::NewLC(); |
|
391 entry->SetKey( array[i]->Entry().LocalUidL() ); |
|
392 entry->SetModified( array[i]->Entry().LastModifiedDateL().TimeUtcL()); |
|
393 if(aIncludeText) |
|
394 { |
|
395 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): aIncludeText true"); |
|
396 HBufC* content = HBufC::NewL( array[i]->Entry().DescriptionL().Length() ); |
|
397 content->Des().Copy( array[i]->Entry().DescriptionL() ); |
|
398 entry->SetContent( content ); |
|
399 } |
|
400 res->AppendL(entry); |
|
401 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After res->AppendL(entry)"); |
|
402 CleanupStack::Pop(entry); |
|
403 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After popping (entry)"); |
|
404 i++; |
|
405 } |
|
406 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): before pop and destroy"); |
|
407 CleanupStack::PopAndDestroy(&array); |
|
408 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After While Loop"); |
|
409 } |
|
410 else |
|
411 { |
|
412 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In else case"); |
|
413 CCalEntry* entryTobeFetched(NULL); |
|
414 entryTobeFetched = iEntryView->FetchL(*aKey); |
|
415 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After Fetching entry"); |
|
416 if(entryTobeFetched) |
|
417 { |
|
418 CleanupStack::PushL(entryTobeFetched); |
|
419 CNpdItem* entry = CNpdItem::NewLC(); |
|
420 entry->SetKey( entryTobeFetched->LocalUidL() ); |
|
421 entry->SetModified( entryTobeFetched->LastModifiedDateL().TimeUtcL() ); |
|
422 if(aIncludeText) |
|
423 { |
|
424 HBufC* content = HBufC::NewL( entryTobeFetched->DescriptionL().Length() ); |
|
425 content->Des().Copy( entryTobeFetched->DescriptionL() ); |
|
426 entry->SetContent( content ); |
|
427 } |
|
428 res->AppendL(entry); |
|
429 CleanupStack::Pop(entry); |
|
430 CleanupStack::PopAndDestroy(entryTobeFetched); |
|
431 } |
|
432 } |
|
433 _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemLC(): end"); |
|
434 return res; |
|
435 } |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // CNSmlNotepadDatabase::CloseAgendaSessions |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 void CNSmlNotepadDatabase::CloseAgendaSessions() |
|
442 { |
|
443 if(iInstanceView) |
|
444 { |
|
445 delete iInstanceView; |
|
446 iInstanceView = NULL; |
|
447 } |
|
448 if(iEntryView) |
|
449 { |
|
450 delete iEntryView; |
|
451 iEntryView = NULL; |
|
452 } |
|
453 if(iSession) |
|
454 { |
|
455 delete iSession; |
|
456 iSession = NULL; |
|
457 } |
|
458 } |
|
459 |
|
460 |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CNpdItem class implementations |
|
464 // ----------------------------------------------------------------------------- |
|
465 |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // CNpdItem::~CNpdItem |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 CNpdItem::~CNpdItem() |
|
472 { |
|
473 _NOTEPAD_DBG_FILE("CNpdItem::~CNpdItem: begin"); |
|
474 delete iContent; |
|
475 _NOTEPAD_DBG_FILE("CNpdItem::~CNpdItem: end"); |
|
476 } |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CNpdItem::NewL |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 CNpdItem* CNpdItem::NewLC() |
|
482 { |
|
483 _NOTEPAD_DBG_FILE("CNpdItem::NewLC: begin"); |
|
484 CNpdItem* tmp = new (ELeave) CNpdItem(); |
|
485 CleanupStack::PushL(tmp); |
|
486 //tmp->ConstructL(0, TTime(), NULL); |
|
487 _NOTEPAD_DBG_FILE("CNpdItem::NewLC: end"); |
|
488 return tmp; |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CNpdItem::NewL |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 CNpdItem* CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent) |
|
496 { |
|
497 _NOTEPAD_DBG_FILE("CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent): begin"); |
|
498 CNpdItem* tmp = new (ELeave) CNpdItem(aKey,aLastModified,aContent); |
|
499 CleanupStack::PushL(tmp); |
|
500 //tmp->ConstructL(aKey, aLastModified, aContent); |
|
501 _NOTEPAD_DBG_FILE("CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent): end"); |
|
502 return tmp; |
|
503 } |
|
504 |
|
505 // ----------------------------------------------------------------------------- |
|
506 // CNpdItem::CNpdItem() |
|
507 // ----------------------------------------------------------------------------- |
|
508 // |
|
509 CNpdItem::CNpdItem() : iKey(0), iLastModified(Time::MinTTime()), iContent(NULL) |
|
510 { |
|
511 _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): begin"); |
|
512 _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): end"); |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // CNpdItem::CNpdItem(TInt aKey,const TTime& aLastModified, HBufC *aContent) |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 CNpdItem::CNpdItem(TInt aKey, |
|
520 const TTime& aLastModified, |
|
521 HBufC *aContent) : iKey(aKey), |
|
522 iLastModified(aLastModified), |
|
523 iContent(aContent) |
|
524 { |
|
525 _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): begin"); |
|
526 _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): end"); |
|
527 } |
|
528 |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CNpdItem::Key |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 TInt CNpdItem::Key() const |
|
535 { |
|
536 _NOTEPAD_DBG_FILE("CNpdItem::Key(): begin"); |
|
537 _NOTEPAD_DBG_FILE("CNpdItem::Key(): end"); |
|
538 return iKey; |
|
539 } |
|
540 // ----------------------------------------------------------------------------- |
|
541 // CNpdItem::LastModified |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 TTime CNpdItem::LastModified() const |
|
545 { |
|
546 _NOTEPAD_DBG_FILE("CNpdItem::LastModified(): begin"); |
|
547 _NOTEPAD_DBG_FILE("CNpdItem::LastModified(): end"); |
|
548 return iLastModified; |
|
549 } |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CNpdItem::Content |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 HBufC* CNpdItem::Content() |
|
555 { |
|
556 _NOTEPAD_DBG_FILE("NpdItem::Content(): begin"); |
|
557 _NOTEPAD_DBG_FILE("NpdItem::Content(): end"); |
|
558 return iContent; |
|
559 } |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CNpdItem::Set |
|
562 // ----------------------------------------------------------------------------- |
|
563 // |
|
564 void CNpdItem::Set(TInt aKey, const TTime& aLastModified, HBufC *aContent) |
|
565 { |
|
566 _NOTEPAD_DBG_FILE("CNpdItem::Set(): begin"); |
|
567 iKey = aKey; |
|
568 iLastModified = aLastModified; |
|
569 SetContent(aContent); |
|
570 _NOTEPAD_DBG_FILE("CNpdItem::Set(): end"); |
|
571 } |
|
572 |
|
573 // ----------------------------------------------------------------------------- |
|
574 // CNpdItem::Set |
|
575 // ----------------------------------------------------------------------------- |
|
576 // |
|
577 void CNpdItem::SetKey(TInt aKey) |
|
578 { |
|
579 _NOTEPAD_DBG_FILE("CNpdItem::SetKey(): begin"); |
|
580 iKey = aKey; |
|
581 _NOTEPAD_DBG_FILE("CNpdItem::SetKey(): end"); |
|
582 } |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // CNpdItem::SetContent |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 void CNpdItem::SetContent(HBufC *aContent) |
|
589 { |
|
590 _NOTEPAD_DBG_FILE("CNpdItem::SetContent(): begin"); |
|
591 iContent = aContent; |
|
592 _NOTEPAD_DBG_FILE("CNpdItem::SetContent(): end"); |
|
593 } |
|
594 |
|
595 // ----------------------------------------------------------------------------- |
|
596 // CNpdItem::SetModified |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 void CNpdItem::SetModified(const TTime& aLastModified) |
|
600 { |
|
601 _NOTEPAD_DBG_FILE("CNpdItem::SetModified(): begin"); |
|
602 iLastModified = aLastModified; |
|
603 _NOTEPAD_DBG_FILE("CNpdItem::SetModified(): end"); |
|
604 } |
|
605 |
|
606 // End of File |
|