|
1 /* |
|
2 * Copyright (c) 2008 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: Converts PIM Event items and native calendar anniversaries |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMAGNANNIVADAPTER_H |
|
20 #define CPIMAGNANNIVADAPTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "cpimagneventadapter.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MPIMEventItem; |
|
27 |
|
28 // CLASS DECLARATION |
|
29 /** |
|
30 * Anniversary Item Adapter |
|
31 * Converts PIM Event items and native calendar anniversaries |
|
32 */ |
|
33 NONSHARABLE_CLASS(CPIMAgnAnnivAdapter) : public CPIMAgnEventAdapter |
|
34 { |
|
35 public: // Constructor and destructor |
|
36 |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 */ |
|
40 static CPIMAgnAnnivAdapter* NewL(java::util::FunctionServer* aFuncServer); |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CPIMAgnAnnivAdapter(); |
|
46 |
|
47 public: // From CPIMAgnEventAdapter |
|
48 |
|
49 /** |
|
50 * Constructs a Agenda Model entry from the framework PIM item. |
|
51 * |
|
52 * @param aItem The item to convert |
|
53 * |
|
54 * @return an entry constructed according to framework item. |
|
55 * The \b ownership of the card is transferred to the caller. |
|
56 * |
|
57 * @par Leaving: |
|
58 * This method may leave. |
|
59 */ |
|
60 CCalEntry* CreateItemToAgnL(const MPIMEventItem& aItem); |
|
61 |
|
62 /** |
|
63 * Converts from Agenda Model entry to the framework PIM item. |
|
64 * |
|
65 * @param aItem PIM Item data container store the entry data. |
|
66 * @param aEntry Agenda Model entry to convert. |
|
67 * |
|
68 * @par Leaving: |
|
69 * This method may leave. |
|
70 */ |
|
71 void ReadAgnToItemL(MPIMEventItem& aItem, |
|
72 CCalEntry& aEntry); |
|
73 |
|
74 /** |
|
75 * Updates the Agenda Model entry according to the framework PIM item. |
|
76 * |
|
77 * @param aItem PIM Item with the current data. |
|
78 * @param aEntry Agenda Model entry to update. |
|
79 * |
|
80 * @par Leaving: |
|
81 * This method may leave. |
|
82 */ |
|
83 void UpdateItemToAgnL(const MPIMEventItem& aItem, |
|
84 CCalEntry& aEntry); |
|
85 |
|
86 private: // From CPIMAgnEventAdapter |
|
87 |
|
88 /** |
|
89 * Converts the start field of an Agenda Model entry into |
|
90 * the framework PIM item field. |
|
91 * Implements the pure virtual method from the base class. |
|
92 * |
|
93 * @param aItem Framework PIM Item. |
|
94 * @param aEntry Agenda Model entry |
|
95 * |
|
96 * @par Leaving: |
|
97 * This method may leave. |
|
98 */ |
|
99 void ReadStartFromAgnL(MPIMEventItem& aItem, CCalEntry& aEntry); |
|
100 |
|
101 /** |
|
102 * Converts a PIM event date field to native calendar entry |
|
103 * This function supports only start field since anniversaries |
|
104 * do not support any other date fields |
|
105 * @param aItem Framework PIM Item. |
|
106 * @param aEntry Native Calendar entry |
|
107 * @param aField Date field which is to be converted |
|
108 * |
|
109 * @par Leaving: |
|
110 * This method may leave. |
|
111 */ |
|
112 void ConvertDateFieldToAgnL( |
|
113 const MPIMEventItem& aItem, |
|
114 CCalEntry& aEntry, |
|
115 const TPIMEventField aField); |
|
116 |
|
117 /** |
|
118 * Converts the end field of an Agenda Model entry into |
|
119 * the framework PIM item field. |
|
120 * Implements the pure virtual method from the base class. |
|
121 * |
|
122 * @param aItem Framework PIM Item. |
|
123 * @param aEntry Agenda Model entry |
|
124 * |
|
125 * @par Leaving: |
|
126 * This method may leave. |
|
127 */ |
|
128 void ReadEndFromAgnL(MPIMEventItem& aItem, CCalEntry& aEntry); |
|
129 |
|
130 /** |
|
131 * Adds default values to the native entry. This function MUST call |
|
132 * the version from the base class since it adds common values for all |
|
133 * event entries in the native database. |
|
134 * |
|
135 * @param aItem PIM API Event item |
|
136 * @param aEntry Native entry which will contain PIM data |
|
137 */ |
|
138 void AddDefaultValuesToEntryL( |
|
139 const MPIMEventItem& aItem, |
|
140 CCalEntry& aEntry) const; |
|
141 |
|
142 protected: |
|
143 |
|
144 void ConstructL(); |
|
145 |
|
146 private: |
|
147 |
|
148 /** |
|
149 * C++ constructor. |
|
150 */ |
|
151 CPIMAgnAnnivAdapter(java::util::FunctionServer* aFuncServer); |
|
152 |
|
153 }; |
|
154 |
|
155 #endif // CPIMAGNANNIVADAPTER_H |
|
156 // End of file |