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