|
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: Provides static information about event lists and creates |
|
15 * event list adapters. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cpimmemoadaptermanager.h" |
|
22 #include "cpimeventlistadapter.h" |
|
23 #include "cpimagnmemoadapter.h" |
|
24 #include "logger.h" |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CPIMMemoAdapterManager::CPIMMemoAdapterManager |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 |
|
33 CPIMMemoAdapterManager::CPIMMemoAdapterManager() |
|
34 { |
|
35 JELOG2(EPim); |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CPIMMemoAdapterManager::ConstructL |
|
40 // Symbian 2nd phase constructor can leave. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 |
|
44 void CPIMMemoAdapterManager::ConstructL(const TDesC& aListName) |
|
45 { |
|
46 JELOG2(EPim); |
|
47 CPIMEventAdapterManager::ConstructL(aListName); |
|
48 |
|
49 iSupportedFields |
|
50 = new(ELeave) CArrayFixFlat<TPIMField> (KPIMSupportedMemoFieldsCount); |
|
51 |
|
52 iSupportedFields->AppendL(KPIMSupportedMemoFields, |
|
53 KPIMSupportedMemoFieldsCount); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CPIMMemoAdapterManager::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 |
|
62 CPIMMemoAdapterManager* CPIMMemoAdapterManager::NewL(const TDesC& aListName) |
|
63 { |
|
64 JELOG2(EPim); |
|
65 CPIMMemoAdapterManager* self = new(ELeave) CPIMMemoAdapterManager(); |
|
66 |
|
67 CleanupStack::PushL(self); |
|
68 self->ConstructL(aListName); |
|
69 CleanupStack::Pop(self); |
|
70 |
|
71 return self; |
|
72 } |
|
73 |
|
74 // Destructor |
|
75 CPIMMemoAdapterManager::~CPIMMemoAdapterManager() |
|
76 { |
|
77 JELOG2(EPim); |
|
78 delete iSupportedFields; |
|
79 delete iRepeatRuleFieldArrayMemoEmpty; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CPIMMemoAdapterManager::GetAdapterManager |
|
84 // Returns: A MPIMAdapterManager representation of this object. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 |
|
88 MPIMAdapterManager* CPIMMemoAdapterManager::GetAdapterManager() |
|
89 { |
|
90 JELOG2(EPim); |
|
91 return this; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CPIMMemoAdapterManager::GetSupportedRepeatRuleFields |
|
96 // Provides the supported repeat rule fields for a given frequency. |
|
97 // Returns: Supported repeat rule fields for \a aFrequency. If no |
|
98 // fields are supported for the frequency, an empty array is returned. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 |
|
102 const CArrayFix<TPIMField>& |
|
103 CPIMMemoAdapterManager::GetSupportedRepeatRuleFieldsL( |
|
104 const TPIMRepeatRuleFrequency& aFrequency) |
|
105 { |
|
106 JELOG2(EPim); |
|
107 if (aFrequency != EPIMRepeatRuleDaily && aFrequency != EPIMRepeatRuleWeekly |
|
108 && aFrequency != EPIMRepeatRuleMonthly && aFrequency |
|
109 != EPIMRepeatRuleYearly) |
|
110 { |
|
111 User::Leave(KErrArgument); // invalid frequency |
|
112 } |
|
113 |
|
114 // Frequency is valid, return an empty array indicating no supported fields |
|
115 if (!iRepeatRuleFieldArrayMemoEmpty) |
|
116 { |
|
117 iRepeatRuleFieldArrayMemoEmpty = new(ELeave) CArrayFixFlat<TInt> (1); |
|
118 } |
|
119 return *iRepeatRuleFieldArrayMemoEmpty; |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CPIMMemoAdapterManager::GetSupportedIntervals |
|
124 // Provides the supported interval values for given frequency. |
|
125 // Returns: Supported interval values for given frequency. If the |
|
126 // interval field is not supported for given frequency, |
|
127 // an empty array is returned. |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 |
|
131 const CArrayFix<TInt>& CPIMMemoAdapterManager::GetSupportedIntervalsL( |
|
132 const TPIMRepeatRuleFrequency& aFrequency) |
|
133 { |
|
134 JELOG2(EPim); |
|
135 // As there are no supported intervals, the GetSupportedRepeatRuleFieldsL |
|
136 // method can be used to check the frequency and to return an empty array |
|
137 return GetSupportedRepeatRuleFieldsL(aFrequency); |
|
138 } |
|
139 |
|
140 // End of File |