89
|
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: Include common routine for each note editor.
|
|
15 |
* For example, handling menu, key event, error handling etc.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include <AknColourSelectionGrid.h>
|
|
20 |
#include <eikrted.h>
|
|
21 |
#include <aknnotewrappers.h>
|
|
22 |
#include <bldvariant.hrh>
|
|
23 |
#include <coeaui.h>
|
|
24 |
#include <eikcapc.h>
|
|
25 |
#include <eikedwin.h>
|
|
26 |
#include <StringLoader.h>
|
|
27 |
#include <aknnavi.h>
|
|
28 |
#include <txtrich.h>
|
|
29 |
#include <hlplch.h>
|
|
30 |
#include <calcalendarinfo.h>
|
|
31 |
#include <Calendar.rsg>
|
|
32 |
#include <calencommonui.rsg>
|
|
33 |
#include <sysutil.h>
|
|
34 |
#include <ErrorUI.h>
|
|
35 |
|
|
36 |
#include "calenmultidbeditor.h"
|
|
37 |
#include "calendarui_debug.h"
|
|
38 |
#include "calendar.hrh"
|
|
39 |
#include "calentitlepane.h"
|
|
40 |
#include "calencontroller.h"
|
|
41 |
#include "calenmultipledbui.h"
|
|
42 |
|
|
43 |
// Constants.
|
|
44 |
const TUint16 KIllegalChars[] = {
|
|
45 |
'<', '>', '"', '/', '//', '|', ':', '*', '?',
|
|
46 |
0xFF02, // Full width quote
|
|
47 |
0xFF0A, // Full width asterisk
|
|
48 |
0xFF0F, // Full width slash
|
|
49 |
0xFF1A, // Full width colon
|
|
50 |
0xFF1C, // Full width left arrow
|
|
51 |
0xFF1E, // Full width right arrow
|
|
52 |
0xFF1F, // Full width question mark
|
|
53 |
0xFF3C, // Full width back slash
|
|
54 |
0xFF5C, // Full width pipe
|
|
55 |
0x201C, // Left quote
|
|
56 |
0x201D, // Right quote
|
|
57 |
0x201F, // Reversed quote
|
|
58 |
0x21B2, // Downwards arrow with tip leftwards
|
|
59 |
0, // Array terminator
|
|
60 |
};
|
|
61 |
const TInt KCalenMaxELAFTextEditorLength(256);
|
|
62 |
const TInt KOne( 1 );
|
|
63 |
const TInt KBuffLength ( 16 );
|
|
64 |
const TInt KTen( 10 );
|
|
65 |
|
|
66 |
// Literals.
|
|
67 |
_LIT( KFormatStringTwoDigit, "%02d" );
|
|
68 |
_LIT( KFormatString, "%d" );
|
|
69 |
|
|
70 |
// ================= MEMBER FUNCTIONS =======================
|
|
71 |
|
|
72 |
// ----------------------------------------------------------------------------
|
|
73 |
// CCalenMultiDBEditor::NewL
|
|
74 |
// Two-phased constructor.
|
|
75 |
// ----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CCalenMultiDBEditor* CCalenMultiDBEditor::NewL(
|
|
78 |
CCalenMultipleDbUi& aMultipleDbui, CCalCalendarInfo& aCalendarInfo,
|
|
79 |
CCalenController& aController, TBool aEditFlag)
|
|
80 |
{
|
|
81 |
TRACE_ENTRY_POINT;
|
|
82 |
|
|
83 |
CCalenMultiDBEditor* self = new (ELeave) CCalenMultiDBEditor(
|
|
84 |
aMultipleDbui, aCalendarInfo, aController, aEditFlag);
|
|
85 |
CleanupStack::PushL(self);
|
|
86 |
self->ConstructL();
|
|
87 |
CleanupStack::Pop(self);
|
|
88 |
|
|
89 |
TRACE_EXIT_POINT;
|
|
90 |
return self;
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// CCalenMultiDBEditor::~CCalenMultiDBEditor
|
|
95 |
// Destructor.
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CCalenMultiDBEditor::~CCalenMultiDBEditor()
|
|
99 |
{
|
|
100 |
TRACE_ENTRY_POINT;
|
|
101 |
|
|
102 |
if(iRgbColors)
|
|
103 |
{
|
|
104 |
iRgbColors->Reset();
|
|
105 |
delete iRgbColors;
|
|
106 |
iRgbColors = NULL;
|
|
107 |
}
|
|
108 |
|
|
109 |
if(iCalendarName)
|
|
110 |
{
|
|
111 |
delete iCalendarName;
|
|
112 |
iCalendarName = NULL;
|
|
113 |
}
|
|
114 |
|
|
115 |
if( iNaviContainer )
|
|
116 |
{
|
|
117 |
iNaviContainer->Pop(); // Remove navi pane used by settings view
|
|
118 |
iNaviContainer = NULL; // iNaviContainer is not owned
|
|
119 |
}
|
|
120 |
TRACE_EXIT_POINT;
|
|
121 |
}
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// CCalenMultiDBEditor::CCalenMultiDBEditor
|
|
125 |
// C++ constructor can NOT contain any code, that might leave.
|
|
126 |
// This overload is used when the repeat type is known.
|
|
127 |
// (other items were commented in a header).
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
CCalenMultiDBEditor::CCalenMultiDBEditor(CCalenMultipleDbUi& aMultipleDbui,
|
|
131 |
CCalCalendarInfo& aCalendarInfo, CCalenController& aController,
|
|
132 |
TBool aEditFlag) :
|
|
133 |
iCalendarInfo(aCalendarInfo), iController(
|
|
134 |
aController), iEditFlag(aEditFlag),
|
|
135 |
iMultipleDbUi(aMultipleDbui)
|
|
136 |
{
|
|
137 |
TRACE_ENTRY_POINT;
|
|
138 |
|
|
139 |
iCalendarStatus = ECalenMultiDbVisible;
|
|
140 |
|
|
141 |
TRACE_EXIT_POINT;
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CCalenMultiDBEditor::ConstructL
|
|
146 |
// Leaving construction common to all editors.
|
|
147 |
// (other items were commented in a header).
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
void CCalenMultiDBEditor::ConstructL()
|
|
151 |
{
|
|
152 |
TRACE_ENTRY_POINT;
|
|
153 |
|
|
154 |
iConflict = CCalenMultiDBEditor::EConflictNone;
|
|
155 |
|
|
156 |
CAknDialog::ConstructL( R_CALEN_MULTIDB_MENUBAR ); // superclass
|
|
157 |
SetTitlePaneL();
|
|
158 |
iCalendarName = HBufC::NewL(KCalenMaxELAFTextEditorLength);
|
|
159 |
|
|
160 |
//Initial color value
|
|
161 |
iColVal = iCalendarInfo.Color().Value();
|
|
162 |
iChoosenColor = TRgb(iColVal);
|
|
163 |
|
|
164 |
iPicture = new( ELeave )CDbColorPicture( TSize( 0, 0 ) );
|
|
165 |
iPicture->SetRgbColorsL(iChoosenColor);
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
LoadColorsL();
|
|
170 |
|
|
171 |
TRACE_EXIT_POINT;
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// CCalenMultiDBEditor::LoadColorsL
|
|
176 |
// (other items were commented in a header).
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
void CCalenMultiDBEditor::LoadColorsL()
|
|
180 |
{
|
|
181 |
TRACE_ENTRY_POINT
|
|
182 |
|
|
183 |
if(iRgbColors)
|
|
184 |
{
|
|
185 |
iRgbColors->Reset();
|
|
186 |
delete iRgbColors;
|
|
187 |
iRgbColors = NULL;
|
|
188 |
}
|
|
189 |
|
|
190 |
iRgbColors = new(ELeave) CArrayFixFlat<TRgb>(2);
|
|
191 |
|
|
192 |
iRgbColors->AppendL(KCalenDarkBlue);
|
|
193 |
iRgbColors->AppendL(KCalenDarkGreen);
|
|
194 |
iRgbColors->AppendL(KCalenDarkRed);
|
|
195 |
iRgbColors->AppendL(KCalenMegenta);
|
|
196 |
iRgbColors->AppendL(KCalenBlue);
|
|
197 |
iRgbColors->AppendL(KCalenGreen);
|
|
198 |
iRgbColors->AppendL(KCalenOrange);
|
|
199 |
iRgbColors->AppendL(KCalenlightMagenta);
|
|
200 |
iRgbColors->AppendL(KCalenCyan);
|
|
201 |
iRgbColors->AppendL(KCalenlightGreen);
|
|
202 |
iRgbColors->AppendL(KCalenYellow);
|
|
203 |
iRgbColors->AppendL(KCalenlightPink);
|
|
204 |
iRgbColors->AppendL(KCalenlightBlue);
|
|
205 |
iRgbColors->AppendL(KCalenGold);
|
|
206 |
iRgbColors->AppendL(KCalenDarkOrange);
|
|
207 |
iRgbColors->AppendL(KCalenPink);
|
|
208 |
|
|
209 |
TRACE_EXIT_POINT
|
|
210 |
}
|
|
211 |
|
|
212 |
// -----------------------------------------------------------------------------
|
|
213 |
// CCalenMultiDBEditor::ProcessCommandL
|
|
214 |
// Process commands from the user.
|
|
215 |
// (other items were commented in a header).
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void CCalenMultiDBEditor::ProcessCommandL( TInt aCommandId )
|
|
219 |
{
|
|
220 |
TRACE_ENTRY_POINT;
|
|
221 |
|
|
222 |
HideMenu();
|
|
223 |
|
|
224 |
switch(aCommandId)
|
|
225 |
{
|
|
226 |
case ECalenMultiDbHelp:
|
|
227 |
{
|
|
228 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
|
|
229 |
(iEikonEnv->AppUi())->AppHelpContextL ());
|
|
230 |
}
|
|
231 |
break;
|
|
232 |
case EAknCmdExit:
|
|
233 |
case EAknSoftkeyExit:
|
|
234 |
{
|
|
235 |
TryExitL( EAknSoftkeyExit );
|
|
236 |
}
|
|
237 |
break;
|
|
238 |
|
|
239 |
case EAknSoftkeyChange:
|
|
240 |
{
|
|
241 |
if( ECalenMultiDbHiddenVisible == IdOfFocusControl() )
|
|
242 |
{
|
|
243 |
iCalendarStatus = iCalendarInfo.Enabled();
|
|
244 |
|
|
245 |
if( ECalenMultiDbHidden == iCalendarStatus )
|
|
246 |
{
|
|
247 |
SetVisiblityFieldL( ECalenMultiDbVisible );
|
|
248 |
iCalendarStatus = ECalenMultiDbVisible;
|
|
249 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
250 |
}
|
|
251 |
else
|
|
252 |
{
|
|
253 |
SetVisiblityFieldL( ECalenMultiDbHidden );
|
|
254 |
iCalendarStatus = ECalenMultiDbHidden;
|
|
255 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
256 |
}
|
|
257 |
}
|
|
258 |
else if ( ECalenMultiDbColor == IdOfFocusControl() )
|
|
259 |
{
|
|
260 |
GetColorL();
|
|
261 |
}
|
|
262 |
}
|
|
263 |
break;
|
|
264 |
|
|
265 |
case EAknSoftkeyOpen:
|
|
266 |
{
|
|
267 |
GetColorL();
|
|
268 |
}
|
|
269 |
break;
|
|
270 |
|
|
271 |
default:
|
|
272 |
{
|
|
273 |
// No implementation yet.
|
|
274 |
}
|
|
275 |
break;
|
|
276 |
}
|
|
277 |
|
|
278 |
TRACE_EXIT_POINT;
|
|
279 |
}
|
|
280 |
|
|
281 |
// -----------------------------------------------------------------------------
|
|
282 |
// CCalenMultiDBEditor::HandleEditCommandL
|
|
283 |
// Process commands from the user.
|
|
284 |
// (other items were commented in a header).
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
void CCalenMultiDBEditor::HandleEditCommandL()
|
|
288 |
{
|
|
289 |
switch(IdOfFocusControl())
|
|
290 |
{
|
|
291 |
case ECalenMultiDbColor:
|
|
292 |
{
|
|
293 |
GetColorL();
|
|
294 |
}
|
|
295 |
break;
|
|
296 |
default:
|
|
297 |
{
|
|
298 |
// No implementation yet.
|
|
299 |
}
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
}
|
|
303 |
|
|
304 |
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
// CCalenMultiDBEditor::SetConflict
|
|
307 |
// (other items were commented in a header).
|
|
308 |
// -----------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
void CCalenMultiDBEditor::SetConflict(TCalendarConflicts aConflict)
|
|
311 |
{
|
|
312 |
TRACE_ENTRY_POINT
|
|
313 |
iConflict = aConflict;
|
|
314 |
TRACE_EXIT_POINT
|
|
315 |
}
|
|
316 |
|
|
317 |
// -----------------------------------------------------------------------------
|
|
318 |
// CCalenMultiDBEditor::Conflict
|
|
319 |
// (other items were commented in a header).
|
|
320 |
// -----------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
CCalenMultiDBEditor::TCalendarConflicts CCalenMultiDBEditor::Conflict() const
|
|
323 |
{
|
|
324 |
TRACE_ENTRY_POINT
|
|
325 |
TRACE_EXIT_POINT
|
|
326 |
return iConflict;
|
|
327 |
}
|
|
328 |
|
|
329 |
// -----------------------------------------------------------------------------
|
|
330 |
// CCalenMultiDBEditor::HandleNotification
|
|
331 |
// (other items were commented in a header).
|
|
332 |
// -----------------------------------------------------------------------------
|
|
333 |
//
|
|
334 |
|
|
335 |
// -----------------------------------------------------------------------------
|
|
336 |
// CCalenMultiDBEditor::OkToExitL
|
|
337 |
// Handle CBA-key on a form.
|
|
338 |
// (other items were commented in a header).
|
|
339 |
// -----------------------------------------------------------------------------
|
|
340 |
//
|
|
341 |
TBool CCalenMultiDBEditor::OkToExitL(TInt aButtonId)
|
|
342 |
{
|
|
343 |
TRACE_ENTRY_POINT;
|
|
344 |
TBool isExitForm(EFalse);
|
|
345 |
|
|
346 |
switch(aButtonId)
|
|
347 |
{
|
|
348 |
case EAknSoftkeyOpen:
|
|
349 |
{
|
|
350 |
GetColorL();
|
|
351 |
}
|
|
352 |
break;
|
|
353 |
|
|
354 |
case EAknSoftkeyOptions:
|
|
355 |
{
|
|
356 |
DisplayMenuL();
|
|
357 |
isExitForm = EFalse;
|
|
358 |
}
|
|
359 |
break;
|
|
360 |
|
|
361 |
case EAknSoftkeyChange:
|
|
362 |
{
|
|
363 |
isExitForm=EFalse;
|
|
364 |
if( ECalenMultiDbHiddenVisible == IdOfFocusControl() )
|
|
365 |
{
|
|
366 |
iCalendarStatus = iCalendarInfo.Enabled();
|
|
367 |
|
|
368 |
if( ECalenMultiDbHidden == iCalendarStatus )
|
|
369 |
{
|
|
370 |
SetVisiblityFieldL( ECalenMultiDbVisible );
|
|
371 |
iCalendarStatus = ECalenMultiDbVisible;
|
|
372 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
373 |
}
|
|
374 |
else
|
|
375 |
{
|
|
376 |
SetVisiblityFieldL( ECalenMultiDbHidden );
|
|
377 |
iCalendarStatus = ECalenMultiDbHidden;
|
|
378 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
379 |
}
|
|
380 |
}
|
|
381 |
else if ( ECalenMultiDbColor == IdOfFocusControl() )
|
|
382 |
{
|
|
383 |
GetColorL();
|
|
384 |
}
|
|
385 |
}
|
|
386 |
break;
|
|
387 |
|
|
388 |
case EAknSoftkeyDone:
|
|
389 |
{
|
|
390 |
isExitForm = SaveNoteL(aButtonId);
|
|
391 |
if (isExitForm)
|
|
392 |
{
|
|
393 |
TInt err = iMultipleDbUi.UpdateOnAddOrEditL(!iEditFlag);
|
|
394 |
if (err != KErrNone)
|
|
395 |
{
|
|
396 |
ShowErrorNoteL(err);
|
|
397 |
}
|
|
398 |
}
|
|
399 |
}
|
|
400 |
break;
|
|
401 |
case EAknSoftkeyExit:
|
|
402 |
case EAknCmdExit:
|
|
403 |
{
|
|
404 |
isExitForm = SaveNoteL(aButtonId);
|
|
405 |
if (isExitForm)
|
|
406 |
{
|
|
407 |
TInt err = iMultipleDbUi.UpdateOnAddOrEditL(!iEditFlag);
|
|
408 |
if (err != KErrNone)
|
|
409 |
{
|
|
410 |
ShowErrorNoteL(err);
|
|
411 |
}
|
|
412 |
}
|
|
413 |
isExitForm = ETrue;
|
|
414 |
iMultipleDbUi.ExitDialogL();
|
|
415 |
}
|
|
416 |
break;
|
|
417 |
case EAknSoftkeyQuit:
|
|
418 |
{
|
|
419 |
isExitForm = ETrue;
|
|
420 |
}
|
|
421 |
break;
|
|
422 |
default:
|
|
423 |
{
|
|
424 |
isExitForm=CAknForm::OkToExitL(aButtonId);
|
|
425 |
}
|
|
426 |
break;
|
|
427 |
}
|
|
428 |
TRACE_EXIT_POINT;
|
|
429 |
|
|
430 |
return isExitForm;
|
|
431 |
}
|
|
432 |
|
|
433 |
// -----------------------------------------------------------------------------
|
|
434 |
// CCalenMultiDBEditor::OfferKeyEventL
|
|
435 |
// Passes key events to MsgEditorView to enable scrolling.
|
|
436 |
// (other items were commented in a header).
|
|
437 |
// -----------------------------------------------------------------------------
|
|
438 |
TKeyResponse CCalenMultiDBEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
439 |
{
|
|
440 |
TRACE_ENTRY_POINT;
|
|
441 |
TKeyResponse keyResponse(EKeyWasNotConsumed);
|
|
442 |
TInt ctrlid=IdOfFocusControl();
|
|
443 |
|
|
444 |
if (aType == EEventKey)
|
|
445 |
{
|
|
446 |
switch (aKeyEvent.iCode)
|
|
447 |
{
|
|
448 |
case EKeyOK:
|
|
449 |
case EKeyEnter:
|
|
450 |
{
|
|
451 |
if( ctrlid == ECalenMultiDbColor)
|
|
452 |
{
|
|
453 |
GetColorL();
|
|
454 |
}
|
|
455 |
else if ( ctrlid == ECalenMultiDbHiddenVisible )
|
|
456 |
{
|
|
457 |
iCalendarStatus = iCalendarInfo.Enabled();
|
|
458 |
if( ECalenMultiDbHidden == iCalendarStatus )
|
|
459 |
{
|
|
460 |
SetVisiblityFieldL( ECalenMultiDbVisible );
|
|
461 |
iCalendarStatus = ECalenMultiDbVisible;
|
|
462 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
463 |
}
|
|
464 |
else
|
|
465 |
{
|
|
466 |
SetVisiblityFieldL( ECalenMultiDbHidden );
|
|
467 |
iCalendarStatus = ECalenMultiDbHidden;
|
|
468 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
469 |
}
|
|
470 |
}
|
|
471 |
keyResponse = EKeyWasConsumed;
|
|
472 |
}
|
|
473 |
break;
|
|
474 |
case EKeyEscape:
|
|
475 |
TryExitL( EAknCmdExit );
|
|
476 |
keyResponse = EKeyWasConsumed;
|
|
477 |
break;
|
|
478 |
default:
|
|
479 |
keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType);
|
|
480 |
break;
|
|
481 |
}
|
|
482 |
}
|
|
483 |
else
|
|
484 |
{
|
|
485 |
// Swallow all other keyevents to prevent the active container processing them.
|
|
486 |
keyResponse = EKeyWasConsumed;
|
|
487 |
}
|
|
488 |
TRACE_EXIT_POINT;
|
|
489 |
return keyResponse;
|
|
490 |
}
|
|
491 |
|
|
492 |
// -----------------------------------------------------------------------------
|
|
493 |
// CCalenMultiDBEditor::PreLayoutDynInitL()
|
|
494 |
// Updates fields just before the form is shown.
|
|
495 |
// (other items were commented in a header).
|
|
496 |
// -----------------------------------------------------------------------------
|
|
497 |
//
|
|
498 |
void CCalenMultiDBEditor::PreLayoutDynInitL()
|
|
499 |
{
|
|
500 |
TRACE_ENTRY_POINT;
|
|
501 |
|
|
502 |
|
|
503 |
|
|
504 |
// Set data to controls in the editor.
|
|
505 |
SetDataToFormL();
|
|
506 |
|
|
507 |
TRACE_EXIT_POINT;
|
|
508 |
}
|
|
509 |
|
|
510 |
// -----------------------------------------------------------------------------
|
|
511 |
// CCalenMultiDBEditor::SetDataToFormL()
|
|
512 |
// Reads data from the entry and updates the form with the appropriate values.
|
|
513 |
// (other items were commented in a header).
|
|
514 |
// -----------------------------------------------------------------------------
|
|
515 |
//
|
|
516 |
void CCalenMultiDBEditor::SetDataToFormL()
|
|
517 |
{
|
|
518 |
TRACE_ENTRY_POINT;
|
|
519 |
//First filed "Name" of the Form
|
|
520 |
CEikEdwin* edwin =
|
|
521 |
reinterpret_cast<CEikEdwin*>(Control(ECalenMultiDbName));
|
|
522 |
|
|
523 |
if( edwin )
|
|
524 |
{
|
|
525 |
edwin->SetTextLimit(KCalenMaxELAFTextEditorLength);
|
|
526 |
edwin->SetSelectionL( edwin->TextLength(), 0 );
|
|
527 |
}
|
|
528 |
|
|
529 |
SetEditableL(ETrue);
|
|
530 |
Line(ECalenMultiDbName)->SetFocus(ETrue);
|
|
531 |
Line(ECalenMultiDbName)->ActivateL();
|
|
532 |
|
|
533 |
HBufC* calendarName = iCalendarInfo.NameL().AllocLC();
|
|
534 |
|
|
535 |
// Check for the empty text.
|
|
536 |
if( ( !calendarName->Size() ) )
|
|
537 |
{
|
|
538 |
CleanupStack::PopAndDestroy(calendarName);
|
|
539 |
TInt index( KOne );
|
|
540 |
calendarName = StringLoader::LoadLC( R_CALE_DB_CALENDAR );
|
|
541 |
TBuf< KBuffLength > numBuf;
|
|
542 |
|
|
543 |
// Check if name is already there or not.
|
|
544 |
while( IsNameFoundL( *calendarName ) )
|
|
545 |
{
|
|
546 |
CleanupStack::PopAndDestroy( calendarName );
|
|
547 |
numBuf.Zero();
|
|
548 |
if( index < KTen )
|
|
549 |
{
|
|
550 |
numBuf.Format( KFormatStringTwoDigit, index );
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
numBuf.Format( KFormatString, index );
|
|
555 |
}
|
|
556 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
557 |
numBuf );
|
|
558 |
calendarName = StringLoader::LoadLC(
|
|
559 |
R_CALE_DB_CALENDAR_DEFAULT_NAME, numBuf );
|
|
560 |
|
|
561 |
++index;
|
|
562 |
}
|
|
563 |
}
|
|
564 |
SetEdwinTextL( ECalenMultiDbName, calendarName );
|
|
565 |
CleanupStack::PopAndDestroy(calendarName);
|
|
566 |
|
|
567 |
//Second field "Color" of the form
|
|
568 |
// Instantiate CDbColorPicture object 300x300 twips in size
|
|
569 |
CEikRichTextEditor* colorControl = static_cast<CEikRichTextEditor*>(Control(ECalenMultiDbColor));
|
|
570 |
|
|
571 |
//Prepare the iPicture header, which will be inserted into the rich text
|
|
572 |
TPictureHeader header;
|
|
573 |
header.iPicture = TSwizzle<CPicture>(iPicture);
|
|
574 |
|
|
575 |
// Position where we insert iPicture is not valid as it always draws icon depending the rect we provide
|
|
576 |
colorControl->RichText()->InsertL(0, header);
|
|
577 |
colorControl->AddFlagToUserFlags(CEikEdwin::EAvkonDisableCursor | CEikEdwin::EReadOnly );
|
|
578 |
GetLineByLineAndPageIndex(1,0)->DrawNow();
|
|
579 |
|
|
580 |
iCalendarStatus = iCalendarInfo.Enabled();
|
|
581 |
|
|
582 |
|
|
583 |
|
|
584 |
if( ECalenMultiDbHidden == iCalendarStatus )
|
|
585 |
{
|
|
586 |
SetVisiblityFieldL( ECalenMultiDbHidden );
|
|
587 |
}
|
|
588 |
else
|
|
589 |
{
|
|
590 |
SetVisiblityFieldL( ECalenMultiDbVisible );
|
|
591 |
}
|
|
592 |
TRACE_EXIT_POINT;
|
|
593 |
}
|
|
594 |
|
|
595 |
// ---------------------------------------------------------
|
|
596 |
// CCalenMultiDBEditor::DynInitMenuPaneL
|
|
597 |
// Gets called before form is displayed
|
|
598 |
// (other items were commented in a header).
|
|
599 |
// ---------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CCalenMultiDBEditor::DynInitMenuPaneL( TInt aResourceId,
|
|
602 |
CEikMenuPane* aMenuPane )
|
|
603 |
{
|
|
604 |
TRACE_ENTRY_POINT;
|
|
605 |
|
|
606 |
if( aResourceId != R_CALEN_MULTIDB_MENUPANE )
|
|
607 |
{
|
|
608 |
return;
|
|
609 |
}
|
|
610 |
|
|
611 |
// Execute the following commands if the resource belongs to calendar.
|
|
612 |
// Display the menu items based on the current focused control.
|
|
613 |
if( ECalenMultiDbName == IdOfFocusControl() )
|
|
614 |
{
|
|
615 |
aMenuPane->SetItemDimmed( EAknSoftkeyChange, ETrue );
|
|
616 |
}
|
|
617 |
|
|
618 |
TRACE_EXIT_POINT;
|
|
619 |
}
|
|
620 |
|
|
621 |
// ---------------------------------------------------------------------------
|
|
622 |
// CCalenMultiDBEditor::GetColorL
|
|
623 |
// From class CAknSettingItem.
|
|
624 |
// GetColorL overridden to launch colour selection grid.
|
|
625 |
// ---------------------------------------------------------------------------
|
|
626 |
//
|
|
627 |
void CCalenMultiDBEditor::GetColorL()
|
|
628 |
{
|
|
629 |
TRACE_ENTRY_POINT;
|
|
630 |
iNoneChoosen = ETrue;
|
|
631 |
|
|
632 |
// Construct colour selection grid
|
|
633 |
CAknDialog *dlg = CAknColourSelectionGrid::NewL(iRgbColors, EFalse,
|
|
634 |
iNoneChoosen,iChoosenColor );
|
|
635 |
|
|
636 |
dlg->ExecuteLD(R_CALEN_MULTIDB_EDITOR_COLOR_GRID_DLG);
|
|
637 |
|
|
638 |
TRACE_EXIT_POINT;
|
|
639 |
}
|
|
640 |
|
|
641 |
// ---------------------------------------------------------------------------
|
|
642 |
// CCalenMultiDBEditor::FocusChanged
|
|
643 |
// ---------------------------------------------------------------------------
|
|
644 |
//
|
|
645 |
void CCalenMultiDBEditor::FocusChanged(TDrawNow /*aDrawNow*/)
|
|
646 |
{
|
|
647 |
TRACE_ENTRY_POINT
|
|
648 |
|
|
649 |
if(IsFocused() && !iNoneChoosen)
|
|
650 |
{
|
|
651 |
iColVal = iChoosenColor.Value();
|
|
652 |
TRAP_IGNORE(iPicture->SetRgbColorsL(iChoosenColor));
|
|
653 |
GetLineByLineAndPageIndex(1, 0)->DrawNow();
|
|
654 |
}
|
|
655 |
|
|
656 |
TRACE_EXIT_POINT
|
|
657 |
}
|
|
658 |
|
|
659 |
// ---------------------------------------------------------------------------
|
|
660 |
// CCalenMultiDBEditor::SaveNoteL
|
|
661 |
// Try to save note. Initializes all the member variables of DBInfo.
|
|
662 |
// ---------------------------------------------------------------------------
|
|
663 |
//
|
|
664 |
TBool CCalenMultiDBEditor::SaveNoteL( TInt aButtonId )
|
|
665 |
{
|
|
666 |
TRACE_ENTRY_POINT;
|
|
667 |
|
|
668 |
if (CheckSpaceBelowCriticalLevelL())
|
|
669 |
{
|
|
670 |
TRACE_EXIT_POINT;
|
|
671 |
return EFalse;
|
|
672 |
}
|
|
673 |
|
|
674 |
if (Conflict() == CCalenMultiDBEditor::EConflictDelete)
|
|
675 |
{
|
|
676 |
CAknNoteDialog *note = new (ELeave) CAknNoteDialog(
|
|
677 |
CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout);
|
|
678 |
HBufC* buf = StringLoader::LoadLC(
|
|
679 |
R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_DELETE, iEikonEnv);
|
|
680 |
note->SetTextL(*buf);
|
|
681 |
note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG);
|
|
682 |
CleanupStack::PopAndDestroy(buf);
|
|
683 |
return ETrue;
|
|
684 |
}
|
|
685 |
else if (Conflict() == CCalenMultiDBEditor::EConflictUpdate)
|
|
686 |
{
|
|
687 |
CAknNoteDialog *note = new (ELeave) CAknNoteDialog(
|
|
688 |
CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout);
|
|
689 |
HBufC* buf = StringLoader::LoadLC(
|
|
690 |
R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_UPDATE, iEikonEnv);
|
|
691 |
note->SetTextL(*buf);
|
|
692 |
note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG);
|
|
693 |
CleanupStack::PopAndDestroy(buf);
|
|
694 |
return ETrue;
|
|
695 |
}
|
|
696 |
else
|
|
697 |
{
|
|
698 |
}
|
|
699 |
|
|
700 |
TBool retValue = ETrue;
|
|
701 |
RPointerArray<CCalCalendarInfo> calendarInfoList;
|
|
702 |
iController.GetAllCalendarInfoL(calendarInfoList);
|
|
703 |
CleanupClosePushL(calendarInfoList);
|
|
704 |
const TBool continueOnError = ETrue;
|
|
705 |
ReadDataFromFormL(continueOnError);
|
|
706 |
|
|
707 |
iCalendarName->Des().Trim();
|
|
708 |
// Check for the empty text
|
|
709 |
if ((!iCalendarName->Size()))
|
|
710 |
{
|
|
711 |
// If in editing mode, just save the name used before.
|
|
712 |
if (iEditFlag)
|
|
713 |
{
|
|
714 |
iCalendarName->Des().Copy(iCalendarInfo.NameL());
|
|
715 |
SetEdwinTextL(ECalenMultiDbName, iCalendarName);
|
|
716 |
}
|
|
717 |
else
|
|
718 |
{
|
|
719 |
// else use the default name.
|
|
720 |
TInt index(KOne);
|
|
721 |
HBufC* calendarName = StringLoader::LoadLC(R_CALE_DB_CALENDAR);
|
|
722 |
TBuf<KBuffLength> numBuf;
|
|
723 |
|
|
724 |
// Check if the name is already present.
|
|
725 |
while (IsNameFoundL(*calendarName))
|
|
726 |
{
|
|
727 |
CleanupStack::PopAndDestroy(calendarName);
|
|
728 |
numBuf.Zero();
|
|
729 |
if (index < KTen)
|
|
730 |
{
|
|
731 |
numBuf.Format(KFormatStringTwoDigit, index);
|
|
732 |
}
|
|
733 |
else
|
|
734 |
{
|
|
735 |
numBuf.Format(KFormatString, index);
|
|
736 |
}
|
|
737 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
738 |
numBuf);
|
|
739 |
calendarName = StringLoader::LoadLC(
|
|
740 |
R_CALE_DB_CALENDAR_DEFAULT_NAME, numBuf);
|
|
741 |
|
|
742 |
++index;
|
|
743 |
}
|
|
744 |
|
|
745 |
iCalendarName->Des().Append(calendarName->Des());
|
|
746 |
|
|
747 |
CleanupStack::PopAndDestroy(calendarName);
|
|
748 |
SetEdwinTextL(ECalenMultiDbName, iCalendarName);
|
|
749 |
}
|
|
750 |
|
|
751 |
}
|
|
752 |
|
|
753 |
// Check for the validity of the calendar name.
|
|
754 |
if (IsNameValid(*iCalendarName))
|
|
755 |
{
|
|
756 |
// Name is valid. then check if it already exists or not.
|
|
757 |
if (IsNameEditedL(*iCalendarName))
|
|
758 |
{
|
|
759 |
TInt index = calendarInfoList.Find(*iCalendarName,
|
|
760 |
CCalenMultiDBEditor::CalenInfoIdentifierL);
|
|
761 |
if (index != KErrNotFound)
|
|
762 |
{
|
|
763 |
retValue = EFalse;
|
|
764 |
if (EAknCmdExit != aButtonId)
|
|
765 |
{
|
|
766 |
HBufC* infoText = StringLoader::LoadLC(
|
|
767 |
R_QTN_CALE_DB_ALREADY_EXISTS_NOTE,
|
|
768 |
iCalendarName->Des());
|
|
769 |
CAknInformationNote* dialog =
|
|
770 |
new (ELeave) CAknInformationNote(ETrue);
|
|
771 |
dialog->ExecuteLD(*infoText);
|
|
772 |
CleanupStack::PopAndDestroy(infoText);
|
|
773 |
}
|
|
774 |
}
|
|
775 |
else
|
|
776 |
{
|
|
777 |
iCalendarInfo.SetNameL(*iCalendarName);
|
|
778 |
}
|
|
779 |
}
|
|
780 |
|
|
781 |
}
|
|
782 |
else
|
|
783 |
{
|
|
784 |
if (EAknCmdExit != aButtonId)
|
|
785 |
{
|
|
786 |
retValue = EFalse;
|
|
787 |
HBufC* infoText(NULL);
|
|
788 |
infoText
|
|
789 |
= AreIllegalChars(*iCalendarName)
|
|
790 |
? StringLoader::LoadLC(
|
|
791 |
R_CALEN_ILLEGAL_CHARACTERS)
|
|
792 |
: StringLoader::LoadLC(
|
|
793 |
R_CALEN_BAD_FILE_NAME);
|
|
794 |
CAknInformationNote* dialog = new (ELeave) CAknInformationNote(
|
|
795 |
ETrue);
|
|
796 |
dialog->ExecuteLD(*infoText);
|
|
797 |
CleanupStack::PopAndDestroy(infoText);
|
|
798 |
}
|
|
799 |
}
|
|
800 |
|
|
801 |
if (IsColorEditedL(iColVal))
|
|
802 |
{
|
|
803 |
iCalendarInfo.SetColor(iColVal);
|
|
804 |
}
|
|
805 |
|
|
806 |
if (IsVisiblityFieldEditedL(iCalendarStatus))
|
|
807 |
{
|
|
808 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
809 |
}
|
|
810 |
|
|
811 |
CleanupStack::PopAndDestroy(&calendarInfoList);
|
|
812 |
TRACE_EXIT_POINT;
|
|
813 |
return retValue;
|
|
814 |
}
|
|
815 |
|
|
816 |
// ---------------------------------------------------------------------------
|
|
817 |
// CCalenMultiDBEditor::ExecuteLD
|
|
818 |
// Launches the MultiDB Form
|
|
819 |
// ---------------------------------------------------------------------------
|
|
820 |
//
|
|
821 |
TInt CCalenMultiDBEditor::ExecuteLD()
|
|
822 |
{
|
|
823 |
TRACE_ENTRY_POINT;
|
|
824 |
TRACE_EXIT_POINT;
|
|
825 |
return CAknForm::ExecuteLD(R_CALEN_MULTIDB_EDITOR);
|
|
826 |
}
|
|
827 |
|
|
828 |
// ---------------------------------------------------------------------------
|
|
829 |
// CCalenMultiDBEditor::ReadDataFromFormL
|
|
830 |
// Read all the data from the form.
|
|
831 |
// ---------------------------------------------------------------------------
|
|
832 |
//
|
|
833 |
void CCalenMultiDBEditor::ReadDataFromFormL( TBool /*aContinueOnError */)
|
|
834 |
{
|
|
835 |
TRACE_ENTRY_POINT;
|
|
836 |
//Initial Name value
|
|
837 |
TPtr summary = iCalendarName->Des();
|
|
838 |
|
|
839 |
CEikEdwin* edwin = reinterpret_cast<CEikEdwin*> (Control(
|
|
840 |
ECalenMultiDbName));
|
|
841 |
GetEdwinText(summary, ECalenMultiDbName);
|
|
842 |
|
|
843 |
TRACE_EXIT_POINT;
|
|
844 |
}
|
|
845 |
// ---------------------------------------------------------------------------
|
|
846 |
// CCalenMultiDBEditor::IsNameEditedL
|
|
847 |
// Checks wether Name got edited or not.
|
|
848 |
// ---------------------------------------------------------------------------
|
|
849 |
//
|
|
850 |
TBool CCalenMultiDBEditor::IsNameEditedL(const TDesC& aName)
|
|
851 |
{
|
|
852 |
TRACE_ENTRY_POINT;
|
|
853 |
HBufC* calendarName = iCalendarInfo.NameL().AllocLC();
|
|
854 |
calendarName->Des().Trim();
|
|
855 |
|
|
856 |
TBool isEdited = EFalse;
|
|
857 |
if (calendarName->CompareF(aName))
|
|
858 |
{
|
|
859 |
isEdited = ETrue;
|
|
860 |
}
|
|
861 |
CleanupStack::PopAndDestroy();
|
|
862 |
TRACE_EXIT_POINT;
|
|
863 |
|
|
864 |
return isEdited;
|
|
865 |
}
|
|
866 |
|
|
867 |
// ---------------------------------------------------------------------------
|
|
868 |
// CCalenMultiDBEditor::IsNameFoundL
|
|
869 |
// Checks wether Name got edited or not.
|
|
870 |
// ---------------------------------------------------------------------------
|
|
871 |
//
|
|
872 |
TBool CCalenMultiDBEditor::IsNameFoundL(const TDesC& aName)
|
|
873 |
{
|
|
874 |
TRACE_ENTRY_POINT;
|
|
875 |
|
|
876 |
TBool retValue = EFalse;
|
|
877 |
RPointerArray<CCalCalendarInfo> calendarInfoList;
|
|
878 |
iController.GetAllCalendarInfoL(calendarInfoList);
|
|
879 |
CleanupClosePushL(calendarInfoList);
|
|
880 |
HBufC *calendarName = aName.AllocLC();
|
|
881 |
|
|
882 |
TInt index = calendarInfoList.Find( *calendarName,
|
|
883 |
CCalenMultiDBEditor::CalenInfoIdentifierL );
|
|
884 |
|
|
885 |
CleanupStack::PopAndDestroy( calendarName );
|
|
886 |
CleanupStack::PopAndDestroy( &calendarInfoList );
|
|
887 |
|
|
888 |
// Name is matched.
|
|
889 |
if(index != KErrNotFound)
|
|
890 |
{
|
|
891 |
retValue = ETrue;
|
|
892 |
}
|
|
893 |
|
|
894 |
TRACE_EXIT_POINT;
|
|
895 |
return retValue;
|
|
896 |
}
|
|
897 |
|
|
898 |
// ---------------------------------------------------------------------------
|
|
899 |
// CCalenMultiDBEditor::AreIllegalChars
|
|
900 |
// Rest of the details are commented in header.
|
|
901 |
// ---------------------------------------------------------------------------
|
|
902 |
//
|
|
903 |
TBool CCalenMultiDBEditor::AreIllegalChars( const TDesC& aName )
|
|
904 |
{
|
|
905 |
TRACE_ENTRY_POINT;
|
|
906 |
|
|
907 |
for ( TInt i( 0 ); KIllegalChars[ i ]; i++ )
|
|
908 |
{
|
|
909 |
if ( aName.Locate( KIllegalChars[ i ] ) != KErrNotFound )
|
|
910 |
{
|
|
911 |
// name is valid.
|
|
912 |
return ETrue;
|
|
913 |
}
|
|
914 |
}
|
|
915 |
TRACE_EXIT_POINT;
|
|
916 |
|
|
917 |
return EFalse;
|
|
918 |
}
|
|
919 |
|
|
920 |
// ---------------------------------------------------------------------------
|
|
921 |
// CCalenMultiDBEditor::IsValidName
|
|
922 |
// Rest of the details are commented in header.
|
|
923 |
// ---------------------------------------------------------------------------
|
|
924 |
//
|
|
925 |
TBool CCalenMultiDBEditor::IsNameValid( const TDesC& aName )
|
|
926 |
{
|
|
927 |
TRACE_ENTRY_POINT;
|
|
928 |
|
|
929 |
// Check name for bad chars
|
|
930 |
const TUint16 KMinAllowedChar = 0x0020;
|
|
931 |
const TUint16 KParagraphSeparator = 0x2029;
|
|
932 |
const TUint16 KDot = '.';
|
|
933 |
|
|
934 |
TInt nameLen( aName.Length() );
|
|
935 |
if ( !nameLen )
|
|
936 |
{
|
|
937 |
return EFalse;
|
|
938 |
}
|
|
939 |
|
|
940 |
for ( TInt i( 0 ); i < nameLen; i++ )
|
|
941 |
{
|
|
942 |
TUint16 ch( aName[ i ] );
|
|
943 |
if ( ch < KMinAllowedChar || ch == KParagraphSeparator )
|
|
944 |
{
|
|
945 |
return EFalse;
|
|
946 |
}
|
|
947 |
}
|
|
948 |
|
|
949 |
// File system ignores totally dot in the end of name, so
|
|
950 |
// we set here as not valid name, so that user gets correctly informed
|
|
951 |
if ( aName[ nameLen - 1 ] == KDot || AreIllegalChars( aName ) )
|
|
952 |
{
|
|
953 |
return EFalse;
|
|
954 |
}
|
|
955 |
return ETrue;
|
|
956 |
}
|
|
957 |
|
|
958 |
// ---------------------------------------------------------------------------
|
|
959 |
// CCalenMultiDBEditor::IsColorEditedL
|
|
960 |
// Checks wether Color got edited or not.
|
|
961 |
// ---------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
TBool CCalenMultiDBEditor::IsColorEditedL(TInt iColVal)
|
|
964 |
{
|
|
965 |
TRACE_ENTRY_POINT;
|
|
966 |
TRACE_EXIT_POINT;
|
|
967 |
return (iCalendarInfo.Color() != iColVal);
|
|
968 |
}
|
|
969 |
|
|
970 |
// ---------------------------------------------------------------------------
|
|
971 |
// CCalenMultiDBEditor::IsVisiblityFieldEditedL
|
|
972 |
// Checks the visibility status of the calendar being edited.
|
|
973 |
// ---------------------------------------------------------------------------
|
|
974 |
//
|
|
975 |
TBool CCalenMultiDBEditor::IsVisiblityFieldEditedL( TInt aCalendarStatus )
|
|
976 |
{
|
|
977 |
TRACE_ENTRY_POINT;
|
|
978 |
TRACE_EXIT_POINT;
|
|
979 |
return (iCalendarInfo.Enabled() != aCalendarStatus );
|
|
980 |
}
|
|
981 |
|
|
982 |
|
|
983 |
// ----------------------------------------------------------------------------
|
|
984 |
// CCalenMultiDBEditor::HandleDialogPageEventL
|
|
985 |
// Process pointer event on the dialog.
|
|
986 |
// (other items were commented in a header).
|
|
987 |
// ----------------------------------------------------------------------------
|
|
988 |
void CCalenMultiDBEditor::HandleDialogPageEventL( TInt aEventID )
|
|
989 |
{
|
|
990 |
TRACE_ENTRY_POINT;
|
|
991 |
|
|
992 |
CAknForm::HandleDialogPageEventL( aEventID );
|
|
993 |
if ( aEventID == MEikDialogPageObserver::EDialogPageTapped )
|
|
994 |
{
|
|
995 |
TInt focusControl( IdOfFocusControl() );
|
|
996 |
|
|
997 |
switch(focusControl)
|
|
998 |
{
|
|
999 |
case ECalenMultiDbColor:
|
|
1000 |
{
|
|
1001 |
GetColorL();
|
|
1002 |
}
|
|
1003 |
break;
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
case ECalenMultiDbHiddenVisible:
|
|
1008 |
{
|
|
1009 |
iCalendarStatus = iCalendarInfo.Enabled();
|
|
1010 |
|
|
1011 |
if( ECalenMultiDbHidden == iCalendarStatus )
|
|
1012 |
{
|
|
1013 |
SetVisiblityFieldL( ECalenMultiDbVisible );
|
|
1014 |
iCalendarStatus = ECalenMultiDbVisible;
|
|
1015 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
1016 |
}
|
|
1017 |
else
|
|
1018 |
{
|
|
1019 |
SetVisiblityFieldL( ECalenMultiDbHidden );
|
|
1020 |
iCalendarStatus = ECalenMultiDbHidden;
|
|
1021 |
iCalendarInfo.SetEnabled(iCalendarStatus);
|
|
1022 |
}
|
|
1023 |
}
|
|
1024 |
break;
|
|
1025 |
|
|
1026 |
default:
|
|
1027 |
{
|
|
1028 |
|
|
1029 |
}
|
|
1030 |
break;
|
|
1031 |
}
|
|
1032 |
}
|
|
1033 |
TRACE_EXIT_POINT;
|
|
1034 |
}
|
|
1035 |
|
|
1036 |
// -----------------------------------------------------------------------------
|
|
1037 |
// CCalenMultiDBEditor::LineChangedL
|
|
1038 |
// This function gets called by the framework each time line is changed in
|
|
1039 |
// the dialog (form). .
|
|
1040 |
// We will use it for MSK label switching.
|
|
1041 |
// (other items were commented in a header).
|
|
1042 |
// -----------------------------------------------------------------------------
|
|
1043 |
//
|
|
1044 |
void CCalenMultiDBEditor::LineChangedL( TInt aControlId )
|
|
1045 |
{
|
|
1046 |
TRACE_ENTRY_POINT;
|
|
1047 |
|
|
1048 |
CEikButtonGroupContainer& cba = ButtonGroupContainer ();
|
|
1049 |
TInt resId = 0;
|
|
1050 |
TInt controlId = aControlId;
|
|
1051 |
|
|
1052 |
switch( controlId )
|
|
1053 |
{
|
|
1054 |
case ECalenMultiDbName:
|
|
1055 |
{
|
|
1056 |
resId = R_CALEN_MULTIDB_MSK_EMPTY_CBA;
|
|
1057 |
}
|
|
1058 |
break;
|
|
1059 |
|
|
1060 |
case ECalenMultiDbColor:
|
|
1061 |
case ECalenMultiDbHiddenVisible:
|
|
1062 |
{
|
|
1063 |
resId = R_CALEN_MULTIDB_MSK_CHANGE_CBA;
|
|
1064 |
}
|
|
1065 |
break;
|
|
1066 |
|
|
1067 |
default:
|
|
1068 |
{
|
|
1069 |
// No implementation yet.
|
|
1070 |
}
|
|
1071 |
break;
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
// set desired CBA
|
|
1075 |
cba.SetCommandSetL( resId );
|
|
1076 |
cba.DrawNow();
|
|
1077 |
|
|
1078 |
TRACE_EXIT_POINT;
|
|
1079 |
}
|
|
1080 |
|
|
1081 |
// -----------------------------------------------------------------------------
|
|
1082 |
// CCalenEditorBase::PostLayoutDynInitL
|
|
1083 |
// This is called in CEikDialog::ExecuteLD() after a form is drawn.
|
|
1084 |
// (other items were commented in a header).
|
|
1085 |
// -----------------------------------------------------------------------------
|
|
1086 |
//
|
|
1087 |
void CCalenMultiDBEditor::PostLayoutDynInitL()
|
|
1088 |
{
|
|
1089 |
TRACE_ENTRY_POINT;
|
|
1090 |
SetEditableL(ETrue);
|
|
1091 |
|
|
1092 |
LineChangedL( ECalenMultiDbName );
|
|
1093 |
|
|
1094 |
CAknForm::PostLayoutDynInitL(); // chain back up to baseclass
|
|
1095 |
TRACE_EXIT_POINT;
|
|
1096 |
}
|
|
1097 |
|
|
1098 |
// -----------------------------------------------------------------------------
|
|
1099 |
// CCalenMultipleDbUi::CalenInfoIdentifierL
|
|
1100 |
// -----------------------------------------------------------------------------
|
|
1101 |
//
|
|
1102 |
TBool CCalenMultiDBEditor::CalenInfoIdentifierL( const HBufC* aName,
|
|
1103 |
const CCalCalendarInfo& aCalendarInfo )
|
|
1104 |
{
|
|
1105 |
TRACE_ENTRY_POINT;
|
|
1106 |
HBufC* calendarName = aCalendarInfo.NameL().AllocLC();
|
|
1107 |
calendarName->Des().Trim();
|
|
1108 |
TBool retVal = EFalse;
|
|
1109 |
retVal = calendarName->Compare(*aName);
|
|
1110 |
CleanupStack::PopAndDestroy();
|
|
1111 |
TRACE_EXIT_POINT;
|
|
1112 |
return (!retVal);
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
// -----------------------------------------------------------------------------
|
|
1116 |
// CDbColorPicture::SetVisiblityFieldL
|
|
1117 |
// Rest of the details are commented in header.
|
|
1118 |
// -----------------------------------------------------------------------------
|
|
1119 |
//
|
|
1120 |
void CCalenMultiDBEditor::SetVisiblityFieldL( TBool aStatusVal )
|
|
1121 |
{
|
|
1122 |
TRACE_ENTRY_POINT;
|
|
1123 |
HBufC* statusString( NULL );
|
|
1124 |
CEikEdwin* fieldText =( CEikEdwin* )Control( ECalenMultiDbHiddenVisible );
|
|
1125 |
if( aStatusVal )
|
|
1126 |
{
|
|
1127 |
// load string Visible
|
|
1128 |
statusString = StringLoader::LoadLC( R_CALE_DB_SHOWN_SETTING ,iCoeEnv );
|
|
1129 |
}
|
|
1130 |
else
|
|
1131 |
{
|
|
1132 |
// load string Hidden
|
|
1133 |
statusString = StringLoader::LoadLC( R_CALE_DB_HIDDEN_SETTING ,iCoeEnv );
|
|
1134 |
}
|
|
1135 |
// set status field string
|
|
1136 |
fieldText->SetTextL( statusString );
|
|
1137 |
fieldText->DrawDeferred();
|
|
1138 |
CleanupStack::PopAndDestroy( statusString );
|
|
1139 |
TRACE_EXIT_POINT;
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
// -----------------------------------------------------------------------------
|
|
1143 |
// CCalenMultiDBEditor::SetTitlePaneL
|
|
1144 |
// Rest of the details are commented in header.
|
|
1145 |
// -----------------------------------------------------------------------------
|
|
1146 |
//
|
|
1147 |
void CCalenMultiDBEditor::SetTitlePaneL()
|
|
1148 |
{
|
|
1149 |
TRACE_ENTRY_POINT;
|
|
1150 |
|
|
1151 |
CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
|
|
1152 |
|
|
1153 |
// Set empty navi pane label
|
|
1154 |
iNaviContainer = static_cast<CAknNavigationControlContainer*>(
|
|
1155 |
sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
|
|
1156 |
iNaviContainer->PushDefaultL();
|
|
1157 |
|
|
1158 |
// Set title text
|
|
1159 |
CAknTitlePane* tp = static_cast<CAknTitlePane*>(
|
|
1160 |
sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
|
|
1161 |
|
|
1162 |
HBufC* titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_CALENDAR , iCoeEnv );
|
|
1163 |
tp->SetTextL( *titleText );
|
|
1164 |
CleanupStack::PopAndDestroy( titleText );
|
|
1165 |
|
|
1166 |
TRACE_EXIT_POINT;
|
|
1167 |
}
|
|
1168 |
|
|
1169 |
// -----------------------------------------------------------------------------
|
|
1170 |
// CCalenMultiDBEditor::SetSyncFieldL
|
|
1171 |
// Rest of the details are commented in header.
|
|
1172 |
// -----------------------------------------------------------------------------
|
|
1173 |
//
|
|
1174 |
void CCalenMultiDBEditor::SetSyncFieldL( TBool aSyncVal )
|
|
1175 |
{
|
|
1176 |
TRACE_ENTRY_POINT;
|
|
1177 |
|
|
1178 |
if(!ControlOrNull(ECalenMultiDbSyncStatus))
|
|
1179 |
{
|
|
1180 |
return;
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
HBufC* syncString( NULL );
|
|
1184 |
CEikEdwin* syncFieldText =( CEikEdwin* )Control( ECalenMultiDbSyncStatus );
|
|
1185 |
if( EFalse == aSyncVal )
|
|
1186 |
{
|
|
1187 |
// load string Off
|
|
1188 |
syncString = StringLoader::LoadLC( R_CALE_SYNC_OFF , iCoeEnv );
|
|
1189 |
}
|
|
1190 |
else
|
|
1191 |
{
|
|
1192 |
// load string On
|
|
1193 |
syncString = StringLoader::LoadLC( R_CALE_SYNC_ON ,iCoeEnv );
|
|
1194 |
}
|
|
1195 |
// set sync field string
|
|
1196 |
syncFieldText->SetTextL( syncString );
|
|
1197 |
syncFieldText->DrawDeferred();
|
|
1198 |
CleanupStack::PopAndDestroy( syncString );
|
|
1199 |
TRACE_EXIT_POINT;
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
// -----------------------------------------------------------------------------
|
|
1203 |
// CheckSpaceBelowCriticalLevelL
|
|
1204 |
// Checks if the Flash File System storage will fall below critical level.
|
|
1205 |
// If there is not enough space, display an error message and return EFalse.
|
|
1206 |
// Return ETrue otherwise.
|
|
1207 |
// (other items were commented in a header).
|
|
1208 |
// -----------------------------------------------------------------------------
|
|
1209 |
//
|
|
1210 |
TBool CCalenMultiDBEditor::CheckSpaceBelowCriticalLevelL()
|
|
1211 |
{
|
|
1212 |
TRACE_ENTRY_POINT;
|
|
1213 |
|
|
1214 |
TBool retcode(EFalse);
|
|
1215 |
if ( SysUtil::FFSSpaceBelowCriticalLevelL( &( iCoeEnv->FsSession() ) ) )
|
|
1216 |
{
|
|
1217 |
ShowErrorNoteL(KErrDiskFull);
|
|
1218 |
retcode = ETrue;
|
|
1219 |
}
|
|
1220 |
TRACE_EXIT_POINT;
|
|
1221 |
return retcode;
|
|
1222 |
}
|
|
1223 |
|
|
1224 |
// -----------------------------------------------------------------------------
|
|
1225 |
// CCalenMultiDBEditor::ShowErrorNoteL
|
|
1226 |
// -----------------------------------------------------------------------------
|
|
1227 |
//
|
|
1228 |
void CCalenMultiDBEditor::ShowErrorNoteL(TInt aError)
|
|
1229 |
{
|
|
1230 |
TRACE_ENTRY_POINT
|
|
1231 |
CErrorUI* errorUi = CErrorUI::NewLC();
|
|
1232 |
errorUi->ShowGlobalErrorNoteL( aError );
|
|
1233 |
CleanupStack::PopAndDestroy( errorUi );
|
|
1234 |
TRACE_EXIT_POINT
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
// -----------------------------------------------------------------------------
|
|
1238 |
// CDbColorPicture::CDbColorPicture
|
|
1239 |
// C++ Constructor
|
|
1240 |
// -----------------------------------------------------------------------------
|
|
1241 |
//
|
|
1242 |
CDbColorPicture::CDbColorPicture(TSize aSize)
|
|
1243 |
: iSize(aSize)
|
|
1244 |
{
|
|
1245 |
TRACE_ENTRY_POINT;
|
|
1246 |
TRACE_EXIT_POINT;
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
// -----------------------------------------------------------------------------
|
|
1250 |
// CDbColorPicture::ExternalizeL
|
|
1251 |
// Pure virtual from CPicture, intentionally empty.
|
|
1252 |
// -----------------------------------------------------------------------------
|
|
1253 |
//
|
|
1254 |
void CDbColorPicture::ExternalizeL(RWriteStream& ) const
|
|
1255 |
{
|
|
1256 |
TRACE_ENTRY_POINT;
|
|
1257 |
TRACE_EXIT_POINT;
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
// -----------------------------------------------------------------------------
|
|
1261 |
// CDbColorPicture::GetOriginalSizeInTwips
|
|
1262 |
// Convert size to twips
|
|
1263 |
// -----------------------------------------------------------------------------
|
|
1264 |
//
|
|
1265 |
void CDbColorPicture::GetOriginalSizeInTwips(TSize& /*aSize*/ ) const
|
|
1266 |
{
|
|
1267 |
TRACE_ENTRY_POINT;
|
|
1268 |
TRACE_EXIT_POINT;
|
|
1269 |
}
|
|
1270 |
|
|
1271 |
// -----------------------------------------------------------------------------
|
|
1272 |
// CDbColorPicture::SetRgbColorsL
|
|
1273 |
// -----------------------------------------------------------------------------
|
|
1274 |
//
|
|
1275 |
void CDbColorPicture::SetRgbColorsL(TRgb aColors)
|
|
1276 |
{
|
|
1277 |
TRACE_ENTRY_POINT;
|
|
1278 |
iColors = aColors;
|
|
1279 |
TRACE_EXIT_POINT;
|
|
1280 |
}
|
|
1281 |
|
|
1282 |
// -----------------------------------------------------------------------------
|
|
1283 |
// CDbColorPicture::Draw
|
|
1284 |
// Draw funtion to draw the map icon
|
|
1285 |
// -----------------------------------------------------------------------------
|
|
1286 |
//
|
|
1287 |
void CDbColorPicture::Draw(CGraphicsContext& aGc,
|
|
1288 |
const TPoint& aTopLeft ,
|
|
1289 |
const TRect& /*aClipRect*/ ,
|
|
1290 |
MGraphicsDeviceMap* /*aMap*/ ) const
|
|
1291 |
{
|
|
1292 |
TRACE_ENTRY_POINT;
|
|
1293 |
|
|
1294 |
|
|
1295 |
//aGc.Reset();
|
|
1296 |
aGc.CancelClippingRect();
|
|
1297 |
|
|
1298 |
TSize pixelsize;
|
|
1299 |
pixelsize.iWidth = 225;
|
|
1300 |
pixelsize.iHeight = 16;
|
|
1301 |
TPoint aPoint;
|
|
1302 |
TRect area = TRect(aTopLeft, pixelsize);
|
|
1303 |
area.Move(0,-11);
|
|
1304 |
// Draw a datbase color rectangle
|
|
1305 |
aGc.SetBrushColor(iColors);
|
|
1306 |
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1307 |
|
|
1308 |
aGc.DrawRect(area);
|
|
1309 |
}
|
|
1310 |
|
|
1311 |
// End of File
|