|
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: Valid event data info. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cpimeventvalidator.h" |
|
21 #include "pimevent.h" |
|
22 #include "logger.h" |
|
23 |
|
24 CPIMEventValidator* CPIMEventValidator::NewL() |
|
25 { |
|
26 JELOG2(EPim); |
|
27 CPIMEventValidator* self = NewLC(); |
|
28 CleanupStack::Pop(self); |
|
29 return self; |
|
30 } |
|
31 |
|
32 CPIMEventValidator* CPIMEventValidator::NewLC() |
|
33 { |
|
34 JELOG2(EPim); |
|
35 CPIMEventValidator* self = new(ELeave) CPIMEventValidator(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 CPIMEventValidator::CPIMEventValidator() : |
|
42 CPIMValidator(KPIMAttrNone) // Event defines no attributes |
|
43 { |
|
44 JELOG2(EPim); |
|
45 } |
|
46 |
|
47 void CPIMEventValidator::ConstructL() |
|
48 { |
|
49 JELOG2(EPim); |
|
50 CPIMValidator::ConstructL(); |
|
51 |
|
52 iValidFields->AppendL(TPIMFieldAndType(EPIMEventAlarm, EPIMFieldInt)); |
|
53 |
|
54 iValidFields->AppendL(TPIMFieldAndType(EPIMEventClass, EPIMFieldInt)); |
|
55 |
|
56 iValidFields->AppendL(TPIMFieldAndType(EPIMEventEnd, EPIMFieldDate)); |
|
57 |
|
58 iValidFields->AppendL(TPIMFieldAndType(EPIMEventLocation, EPIMFieldString)); |
|
59 |
|
60 iValidFields->AppendL(TPIMFieldAndType(EPIMEventNote, EPIMFieldString)); |
|
61 |
|
62 iValidFields->AppendL(TPIMFieldAndType(EPIMEventRevision, EPIMFieldDate)); |
|
63 |
|
64 iValidFields->AppendL(TPIMFieldAndType(EPIMEventStart, EPIMFieldDate)); |
|
65 |
|
66 iValidFields->AppendL(TPIMFieldAndType(EPIMEventSummary, EPIMFieldString)); |
|
67 |
|
68 iValidFields->AppendL(TPIMFieldAndType(EPIMEventUid, EPIMFieldString)); |
|
69 } |
|
70 |
|
71 CPIMEventValidator::~CPIMEventValidator() |
|
72 { |
|
73 JELOG2(EPim); |
|
74 } |
|
75 |
|
76 TBool CPIMEventValidator::IsValidIntegerValue(const TPIMField& aField, |
|
77 const TInt& aValue) const |
|
78 { |
|
79 JELOG2(EPim); |
|
80 TBool retVal = ETrue; |
|
81 |
|
82 if (aField == EPIMEventClass) |
|
83 { |
|
84 // contact class has predefined values |
|
85 if ((aValue != EPIMEventClassConfidential) && (aValue |
|
86 != EPIMEventClassPrivate) && (aValue != EPIMEventClassPublic)) |
|
87 { |
|
88 // not one of predefined values |
|
89 retVal = EFalse; |
|
90 } |
|
91 } |
|
92 // else any integer is OK |
|
93 |
|
94 return retVal; |
|
95 } |
|
96 |
|
97 // End of File |