|
1 /* |
|
2 * Copyright (c) 2002 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: Define CCalenEditorBase class, which is derived from CAknForm. |
|
15 * CCalenEditorBase is the base class of CCalenMeetingEditor, |
|
16 * CCalenAnnivEditor, CCalenTodoEditor and CCalenDayEditor. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef CALENMULTIDBEDITOR_H |
|
21 #define CALENMULTIDBEDITOR_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <AknForm.h> |
|
25 #include <gdi.h> |
|
26 |
|
27 class CalenAppUi; |
|
28 class CAknNavigationControlContainer; |
|
29 class CCalenController; |
|
30 class CCalCalendarInfo; |
|
31 |
|
32 /** |
|
33 * Class defining Map icon picture, derived from CPicture |
|
34 */ |
|
35 class CDbColorPicture : public CPicture |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * C++ Constructor |
|
40 */ |
|
41 CDbColorPicture( TSize aSize); |
|
42 |
|
43 /** |
|
44 * Draw funtion to draw the map icon |
|
45 */ |
|
46 void Draw( CGraphicsContext& aGc, |
|
47 const TPoint& aTopLeft, |
|
48 const TRect& aClipRect, |
|
49 MGraphicsDeviceMap* aMap ) const; |
|
50 |
|
51 /** |
|
52 * Pure virtual from CPicture, intentionally empty. |
|
53 */ |
|
54 void ExternalizeL( RWriteStream& aStream ) const; |
|
55 |
|
56 /** |
|
57 * Convert size to twips |
|
58 */ |
|
59 void GetOriginalSizeInTwips( TSize& aSize ) const; |
|
60 |
|
61 void SetRgbColorsL(TRgb aColor); |
|
62 |
|
63 |
|
64 protected: |
|
65 TSize iSize; |
|
66 TRgb iColors; |
|
67 |
|
68 }; |
|
69 |
|
70 // Enum for calendar status. |
|
71 enum TCalendarStatus |
|
72 { |
|
73 ECalenMultiDbHidden = 0, |
|
74 ECalenMultiDbVisible |
|
75 }; |
|
76 |
|
77 // CLASS DEFINITIONS |
|
78 /** |
|
79 *CCalenNoteForm |
|
80 * |
|
81 * Base class of editor forms. |
|
82 */ |
|
83 |
|
84 NONSHARABLE_CLASS( CCalenMultiDBEditor ) : public CAknForm |
|
85 |
|
86 { |
|
87 public: // Constructors and destructor |
|
88 |
|
89 enum TCalendarConflicts |
|
90 { |
|
91 EConflictNone, |
|
92 EConflictDelete, |
|
93 EConflictUpdate |
|
94 }; |
|
95 |
|
96 |
|
97 /** |
|
98 * Destructor. |
|
99 */ |
|
100 virtual ~CCalenMultiDBEditor(); |
|
101 |
|
102 public: // New Functions |
|
103 |
|
104 /** |
|
105 * Two-phased constructor. |
|
106 */ |
|
107 static CCalenMultiDBEditor* NewL( CCalCalendarInfo& aCalendarInfo, |
|
108 CCalenController& aController, TBool aEditFlag); |
|
109 |
|
110 /** |
|
111 * From Base class. |
|
112 */ |
|
113 void DynInitMenuPaneL( TInt aResourceId, |
|
114 CEikMenuPane* aMenuPane ); |
|
115 /** |
|
116 * Launches the MultipleDb form. |
|
117 */ |
|
118 TInt ExecuteLD(); |
|
119 |
|
120 void HandleEditCommandL(); |
|
121 |
|
122 protected: |
|
123 |
|
124 /** |
|
125 * C++ constructor. |
|
126 */ |
|
127 CCalenMultiDBEditor( CCalCalendarInfo& aCalendarInfo, |
|
128 CCalenController& aController, TBool aEditFlag); |
|
129 |
|
130 |
|
131 protected: // Functions from base classes |
|
132 |
|
133 |
|
134 /** |
|
135 * From Base class. |
|
136 */ |
|
137 TBool OkToExitL(TInt aButtonId); |
|
138 |
|
139 /** |
|
140 * From CCoeControl. |
|
141 */ |
|
142 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
143 |
|
144 /** |
|
145 * From CCalenFormBase and CEikDialog |
|
146 */ |
|
147 void PreLayoutDynInitL(); |
|
148 |
|
149 void PostLayoutDynInitL(); |
|
150 |
|
151 /** |
|
152 * From CEikDialog |
|
153 * Command handling |
|
154 */ |
|
155 void ProcessCommandL( TInt aCommandId ); |
|
156 |
|
157 /** |
|
158 * Reads all the data from the form. |
|
159 */ |
|
160 void ReadDataFromFormL( TBool aContinueOnError ); |
|
161 |
|
162 |
|
163 |
|
164 void HandleDialogPageEventL( TInt aEventID ); |
|
165 |
|
166 private: |
|
167 |
|
168 /** |
|
169 * Try to save note. Initializes all the member variables of DBInfo. |
|
170 * returns true if succeded, else otherwise. |
|
171 */ |
|
172 TBool SaveNoteL(TInt aButtonId); |
|
173 |
|
174 /** |
|
175 * Launches the color pallette. |
|
176 */ |
|
177 void GetColorL(); |
|
178 |
|
179 /** |
|
180 * Second stage constructor |
|
181 * Performs any leaving operations needed for construction. |
|
182 */ |
|
183 void ConstructL(); |
|
184 |
|
185 /** |
|
186 * Sets all the fields into Form. |
|
187 */ |
|
188 void SetDataToFormL(); |
|
189 |
|
190 /** |
|
191 * @brief Check for the Name, whether it got edited or not. |
|
192 * @param aName name of the calendar. |
|
193 * @return ETrue if got edited, else otherwise. |
|
194 */ |
|
195 TBool IsNameEditedL( const TDesC& aName ); |
|
196 |
|
197 /** |
|
198 * @brief Check for the Name, whether it is unique or not. |
|
199 * @param aName name of the calendar. |
|
200 * @return ETrue if name is found, else otherwise. |
|
201 */ |
|
202 TBool IsNameFoundL( const TDesC& aName ); |
|
203 |
|
204 /** |
|
205 * @brief Check that if given file name contains illegal characters |
|
206 * @param aName name of the calendar. |
|
207 * @return ETrue if calendar name is valid |
|
208 */ |
|
209 TBool AreIllegalChars( const TDesC& aName ); |
|
210 |
|
211 /** |
|
212 * @brief Is given calendar name valid |
|
213 * @param aName name of the calendar. |
|
214 * @return ETrue if calendar name is valid |
|
215 */ |
|
216 TBool IsNameValid( const TDesC& aName ); |
|
217 |
|
218 /** |
|
219 * Check for the Color, whether it got edited or not. |
|
220 * returns ETrue if got edited, else otherwise. |
|
221 */ |
|
222 TBool IsColorEditedL(TInt colVal); |
|
223 |
|
224 /** |
|
225 * @brief Check for the CalendarStatus, whether it got edited or not. |
|
226 * @param aCalendarStatus Calendar status. |
|
227 * @return ETrue if got edited, else otherwise. |
|
228 */ |
|
229 TBool IsVisiblityFieldEditedL( TInt aCalendarStatus ); |
|
230 |
|
231 /** |
|
232 * @brief Set the calendar status. |
|
233 * @param aValue calendar status. |
|
234 */ |
|
235 void SetVisiblityFieldL( TBool aStatusVal ); |
|
236 |
|
237 /** |
|
238 * setup title pane for the status pane |
|
239 * @return void |
|
240 */ |
|
241 void SetTitlePaneL(); |
|
242 |
|
243 void SetSyncFieldL( TBool aSyncVal ); |
|
244 protected: |
|
245 |
|
246 /** |
|
247 * From CEikDialog |
|
248 * We will hit this event each time a line has changed in the form |
|
249 */ |
|
250 void LineChangedL( TInt aControlId ); |
|
251 |
|
252 private: |
|
253 /** |
|
254 * @brief Find calendarinfo object based on calendar name |
|
255 * |
|
256 * @param aName calendar filename |
|
257 * @param aCalendarInfo referance for calendarinfo |
|
258 * @return TBool find status |
|
259 */ |
|
260 static TBool CalenInfoIdentifierL( const HBufC* aCalendarName, |
|
261 const CCalCalendarInfo& aInfoItem ); |
|
262 public: |
|
263 void SetConflict(TCalendarConflicts aConflict); |
|
264 |
|
265 TCalendarConflicts Conflict() const; |
|
266 |
|
267 private://data |
|
268 |
|
269 CCalCalendarInfo& iCalendarInfo; |
|
270 HBufC* iCalendarName; |
|
271 CCalenController& iController; |
|
272 TInt iColVal; // Color id |
|
273 TBool iCalendarStatus; |
|
274 TRgb iColors; |
|
275 CDbColorPicture* iPicture; |
|
276 TBool iEditFlag; |
|
277 CAknNavigationControlContainer* iNaviContainer; |
|
278 //Sync field, EFalse then Sync off else Sync On |
|
279 TBool iSyncStatus; |
|
280 TCalendarConflicts iConflict; |
|
281 }; |
|
282 |
|
283 #endif // CALENMULTIDBEDITOR_H |
|
284 |
|
285 |
|
286 // End of File |