66
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 : Class description for unified editor
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// user includes
|
|
19 |
#include "calenunifiededitor.h"
|
|
20 |
#include "CalenDefaultEditors.hrh"
|
|
21 |
#include "calenglobaldata.h"
|
|
22 |
#include "calenunifiededitorcontrol.h"
|
|
23 |
#include "calendbfield.h"
|
|
24 |
#include "calenlocationutil.h"
|
|
25 |
#include "CalenEntryUpdater.h"
|
|
26 |
#include "CalenEditorDataHandler.h"
|
|
27 |
#include "calenentryutil.h"
|
|
28 |
#include "calensend.h"
|
|
29 |
#include "CalenDescription.h"
|
|
30 |
#include "calenattachmentinfo.h"
|
|
31 |
#include "calenattachmentmodel.h"
|
|
32 |
#include "CleanupResetAndDestroy.h"
|
|
33 |
#include "CalendarPrivateCRKeys.h"
|
|
34 |
#include "CalenUid.h"
|
|
35 |
|
|
36 |
// system includes
|
|
37 |
#include <coemain.h>
|
|
38 |
#include <eikdialg.h>
|
|
39 |
#include <bacntf.h>
|
|
40 |
#include <eikspane.h>
|
|
41 |
#include <akntitle.h>
|
|
42 |
#include <aknnavi.h>
|
|
43 |
#include <eikcapc.h>
|
|
44 |
#include <StringLoader.h>
|
|
45 |
#include <featmgr.h>
|
|
46 |
#include <hlplch.h>
|
|
47 |
#include <AknQueryDialog.h>
|
|
48 |
#include <AknUtils.h>
|
|
49 |
#include <AknIconUtils.h>
|
|
50 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
51 |
#include <eikrted.h>
|
|
52 |
#include <txtrich.h>
|
|
53 |
#include <aknnotewrappers.h>
|
|
54 |
#include <sysutil.h>
|
|
55 |
#include <ErrorUI.h>
|
|
56 |
#include <EPos_CPosLandmark.h>
|
|
57 |
#include <lbsposition.h>
|
|
58 |
#include <calentry.h>
|
|
59 |
#include <CalenDefaultEditorsData.rsg>
|
|
60 |
#include <Calendar.rsg>
|
|
61 |
#include <calenagendautils.h> // Need to conform the access.
|
|
62 |
#include <calrrule.h>
|
|
63 |
#include <calendateutils.h>
|
|
64 |
#include <CalenInterimUtils2.h>
|
|
65 |
#include <centralrepository.h>
|
|
66 |
#include <calencommands.hrh> // Calendar commands
|
|
67 |
#include <calencontext.h>
|
|
68 |
#include <caleninstanceid.h> // TCalenInstanceId
|
|
69 |
#include <calenservices.h>
|
|
70 |
#include <calcalendarinfo.h>
|
|
71 |
#include <vwsdef.h>
|
|
72 |
|
|
73 |
// debug
|
|
74 |
#include "calendarui_debug.h"
|
|
75 |
|
|
76 |
const TInt KCalenMaxELAFTextEditorLength(160);
|
|
77 |
const TInt KCalenMaxAPACTextEditorLength(70);
|
|
78 |
|
|
79 |
// Custom id for command to close form without any checks.
|
|
80 |
// We need just to close form without saving, when entry is deleted from options menu
|
|
81 |
const TInt KCalenButtonIdCloseForm(-400);
|
|
82 |
|
|
83 |
_LIT(KComma, ",");
|
|
84 |
_LIT(KEmpty,"");
|
|
85 |
_LIT(KAttachmentSeparator,"; ");
|
|
86 |
_LIT( KReplaceWhitespaceChars, "\x0009\x000A\x000B\x000C\x000D\x2028\x2029" );
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
// CCalenUnifiedEditor::NewL
|
|
90 |
// Two-phased constructor.
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
CCalenUnifiedEditor* CCalenUnifiedEditor::NewL( CCalEntry& aEntry,
|
|
94 |
const TAgnEntryUiInParams& aParams,
|
|
95 |
MAgnEntryUiCallback& aCallback,
|
|
96 |
TAgnEntryUiOutParams& aOutParams,
|
|
97 |
CalCommon::TRecurrenceRange aRepeatType)
|
|
98 |
{
|
|
99 |
TRACE_ENTRY_POINT;
|
|
100 |
|
|
101 |
CCalenUnifiedEditor* self =
|
|
102 |
new (ELeave) CCalenUnifiedEditor( aEntry, aParams, aCallback, aOutParams, aRepeatType );
|
|
103 |
CleanupStack::PushL( self );
|
|
104 |
self->ConstructL();
|
|
105 |
CleanupStack::Pop();
|
|
106 |
|
|
107 |
TRACE_EXIT_POINT;
|
|
108 |
return self;
|
|
109 |
}
|
|
110 |
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
// CCalenUnifiedEditor::NewL
|
|
113 |
// Two-phased constructor.
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
CCalenUnifiedEditor* CCalenUnifiedEditor::NewL( CCalEntry& aEntry,
|
|
117 |
const TAgnEntryUiInParams& aParams,
|
|
118 |
MAgnEntryUiCallback& aCallback,
|
|
119 |
TAgnEntryUiOutParams& aOutParams )
|
|
120 |
{
|
|
121 |
TRACE_ENTRY_POINT;
|
|
122 |
|
|
123 |
CCalenUnifiedEditor* self =
|
|
124 |
new (ELeave) CCalenUnifiedEditor( aEntry, aParams, aCallback, aOutParams );
|
|
125 |
CleanupStack::PushL(self);
|
|
126 |
self->ConstructL();
|
|
127 |
CleanupStack::Pop();
|
|
128 |
|
|
129 |
TRACE_EXIT_POINT;
|
|
130 |
return self;
|
|
131 |
}
|
|
132 |
|
|
133 |
// -----------------------------------------------------------------------------
|
|
134 |
// CCalenUnifiedEditor::~CCalenUnifiedEditor
|
|
135 |
// Destructor
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
CCalenUnifiedEditor::~CCalenUnifiedEditor()
|
|
139 |
{
|
|
140 |
TRACE_ENTRY_POINT;
|
|
141 |
|
|
142 |
iFetchedEntries.ResetAndDestroy();
|
|
143 |
|
|
144 |
if( iGlobalData )
|
|
145 |
{
|
|
146 |
iGlobalData->Release();
|
|
147 |
}
|
|
148 |
|
|
149 |
// Remove default status pane
|
|
150 |
if( iNaviContainer )
|
|
151 |
{
|
|
152 |
iNaviContainer->Pop();
|
|
153 |
iNaviContainer = NULL;
|
|
154 |
}
|
|
155 |
|
|
156 |
if( iIdle )
|
|
157 |
{
|
|
158 |
delete iIdle;
|
|
159 |
}
|
|
160 |
iCoeEnv->RemoveFepObserver( *this );
|
|
161 |
|
|
162 |
if( iServices )
|
|
163 |
{
|
|
164 |
iServices->CancelNotifications( this );
|
|
165 |
}
|
|
166 |
delete iLocaleChangeNotifier;
|
|
167 |
delete iOriginalCalEntry;
|
|
168 |
delete iEditorDataHandler;
|
|
169 |
delete iEntryUpdater;
|
|
170 |
delete iUnifiedEditorControl;
|
|
171 |
|
|
172 |
iCollectionIds.Reset();
|
|
173 |
|
|
174 |
iAsyncCallback->Cancel();
|
|
175 |
delete iAsyncCallback;
|
|
176 |
|
|
177 |
TRACE_EXIT_POINT;
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
// CCalenUnifiedEditor::CCalenUnifiedEditor
|
|
182 |
// Default constructor
|
|
183 |
// -----------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
CCalenUnifiedEditor::CCalenUnifiedEditor( CCalEntry& aEntry,
|
|
186 |
const TAgnEntryUiInParams& aParams,
|
|
187 |
MAgnEntryUiCallback& aCallback,
|
|
188 |
TAgnEntryUiOutParams& aOutParams,
|
|
189 |
CalCommon::TRecurrenceRange aRepeatType )
|
|
190 |
: iEditedCalEntry( aEntry ), iEntryUiInParams( aParams ),
|
|
191 |
iEntryUiCallback( aCallback ), iEntryUiOutParams( aOutParams ),
|
|
192 |
iRepeatType( aRepeatType ), iEntryType( aEntry.EntryTypeL() ),
|
|
193 |
iHasChosenRepeatType( ETrue ), iIgnoreFirstLocaleChange( ETrue ),
|
|
194 |
iCurrentDurationDay( 0 ), iTwoSeconds( 2 )
|
|
195 |
|
|
196 |
|
|
197 |
{
|
|
198 |
TRACE_ENTRY_POINT;
|
|
199 |
|
|
200 |
TRACE_EXIT_POINT;
|
|
201 |
}
|
|
202 |
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
// CCalenUnifiedEditor::CCalenUnifiedEditor
|
|
205 |
// Default constructor
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
CCalenUnifiedEditor::CCalenUnifiedEditor( CCalEntry& aEntry,
|
|
209 |
const TAgnEntryUiInParams& aParams,
|
|
210 |
MAgnEntryUiCallback& aCallback,
|
|
211 |
TAgnEntryUiOutParams& aOutParams )
|
|
212 |
: iEditedCalEntry( aEntry ), iEntryUiInParams( aParams ),
|
|
213 |
iEntryUiCallback( aCallback ), iEntryUiOutParams( aOutParams ),
|
|
214 |
iRepeatType( CalCommon::EThisAndAll ),
|
|
215 |
iEntryType( aEntry.EntryTypeL() ),
|
|
216 |
iHasChosenRepeatType( EFalse ),
|
|
217 |
iIgnoreFirstLocaleChange( ETrue ),
|
|
218 |
iCurrentDurationDay( 0 ), iTwoSeconds( 2 )
|
|
219 |
|
|
220 |
|
|
221 |
{
|
|
222 |
TRACE_ENTRY_POINT;
|
|
223 |
TRACE_EXIT_POINT;
|
|
224 |
}
|
|
225 |
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
// CCalenUnifiedEditor::ConstructL
|
|
228 |
// Second phase construction
|
|
229 |
// -----------------------------------------------------------------------------
|
|
230 |
//
|
|
231 |
void CCalenUnifiedEditor::ConstructL()
|
|
232 |
{
|
|
233 |
TRACE_ENTRY_POINT;
|
|
234 |
|
|
235 |
// Construct dialog
|
|
236 |
CAknDialog::ConstructL( R_CALEN_UNIFIED_EDITOR_MENUBAR );
|
|
237 |
|
|
238 |
// Take a timestamp of the editors opening time - 2 seconds
|
|
239 |
// We use this to compare against the last database change time
|
|
240 |
// to determine if the current entry has been deleted through
|
|
241 |
// another CCalSession
|
|
242 |
iTimeStamp.UniversalTime();
|
|
243 |
|
|
244 |
iGlobalData = CCalenGlobalData::InstanceL( iEntryUiInParams.iCalSession );
|
|
245 |
|
|
246 |
iOriginalCalEntry = CCalenUnifiedEditor::CreateCopyL( iEditedCalEntry );
|
|
247 |
|
|
248 |
// Setup title and status panes
|
|
249 |
CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
|
|
250 |
CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle) ) );
|
|
251 |
HBufC* titleText = StringLoader::LoadLC( R_QTN_CALE_UNIFIED_EDITOR_TITLE, iCoeEnv );
|
|
252 |
tp->SetTextL( *titleText );
|
|
253 |
CleanupStack::PopAndDestroy( titleText );
|
|
254 |
|
|
255 |
// Put default, empty Status Pane.
|
|
256 |
iNaviContainer = static_cast<CAknNavigationControlContainer *>( sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi) ) );
|
|
257 |
iNaviContainer->PushDefaultL();
|
|
258 |
|
|
259 |
// Connect to services, and register for notifications of
|
|
260 |
// changes to the database.
|
|
261 |
TInt services( iEntryUiInParams.iSpare );
|
|
262 |
iServices = reinterpret_cast< MCalenServices* >( services );
|
|
263 |
|
|
264 |
RArray<TCalenNotification> notificationArray;
|
|
265 |
notificationArray.Append( ECalenNotifyEntryDeleted );
|
|
266 |
notificationArray.Append( ECalenNotifyInstanceDeleted );
|
|
267 |
notificationArray.Append( ECalenNotifyDeleteFailed );
|
|
268 |
notificationArray.Append( ECalenNotifyEntryInstanceViewCreated );
|
|
269 |
notificationArray.Append( ECalenNotifyExternalDatabaseChanged );
|
|
270 |
notificationArray.Append( ECalenNotifyMapClosed );
|
|
271 |
notificationArray.Append( ECalenNotifyAttachmentAdded );
|
|
272 |
notificationArray.Append( ECalenNotifyAttachmentRemoved );
|
|
273 |
notificationArray.Append( ECalenNotifyCalendarFileDeleted );
|
|
274 |
|
|
275 |
|
|
276 |
iServices->RegisterForNotificationsL( this, notificationArray );
|
|
277 |
notificationArray.Reset();
|
|
278 |
|
|
279 |
GetAllCollectionidsL(iCollectionIds);
|
|
280 |
|
|
281 |
iEditorDataHandler = CCalenEditorDataHandler::NewL( iEditedCalEntry,
|
|
282 |
iEntryUiInParams.iInstanceDate,
|
|
283 |
IsCreatingNewEntry(),
|
|
284 |
MaxTextEditorLength(),
|
|
285 |
*iServices , iCollectionIds);
|
|
286 |
iEntryUpdater = CCalenEntryUpdater::NewL( *iServices , iCollectionIds);
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
//iServices->EntryViewL(iServices->Context().InstanceId().iColId);
|
|
291 |
|
|
292 |
iUnifiedEditorControl = CCalenUnifiedEditorControl::NewL( *this,*iServices );
|
|
293 |
|
|
294 |
isReplaceLocation = EFalse;
|
|
295 |
|
|
296 |
iCheck = EFalse;
|
|
297 |
TCallBack callback(CCalenUnifiedEditor::AsyncProcessCommandL,this);
|
|
298 |
iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
|
|
299 |
|
|
300 |
|
|
301 |
iIdle = CIdle::NewL( CActive::EPriorityUserInput );
|
|
302 |
iIdle->Start( TCallBack( KeyCallBack, this) );
|
|
303 |
iCoeEnv->AddFepObserverL( *this );
|
|
304 |
|
|
305 |
TRACE_EXIT_POINT;
|
|
306 |
}
|
|
307 |
|
|
308 |
// -----------------------------------------------------------------------------
|
|
309 |
// CCalenUnifiedEditor::ExecuteViewL
|
|
310 |
// Dummy implementation. Use ExecuteLD() instead.
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
TInt CCalenUnifiedEditor::ExecuteViewL( RPointerArray<CCalEntry>& /*aEntries*/,
|
|
314 |
const TAgnEntryUiInParams& /*aInParams*/,
|
|
315 |
TAgnEntryUiOutParams& /*aOutParams*/,
|
|
316 |
MAgnEntryUiCallback& /*aCallback*/ )
|
|
317 |
{
|
|
318 |
TRACE_ENTRY_POINT;
|
|
319 |
TRACE_EXIT_POINT;
|
|
320 |
return KErrNone;
|
|
321 |
}
|
|
322 |
|
|
323 |
// -----------------------------------------------------------------------------
|
|
324 |
// CCalenUnifiedEditor::SetHelpContext
|
|
325 |
// Sets the help context.
|
|
326 |
// (other items were commented in a header).
|
|
327 |
// -----------------------------------------------------------------------------
|
|
328 |
//
|
|
329 |
void CCalenUnifiedEditor::SetHelpContext( const TCoeHelpContext& /*aContext*/ )
|
|
330 |
{
|
|
331 |
TRACE_ENTRY_POINT;
|
|
332 |
TRACE_EXIT_POINT;
|
|
333 |
}
|
|
334 |
|
|
335 |
// -----------------------------------------------------------------------------
|
|
336 |
// CCalenUnifiedEditor::HandleNotification
|
|
337 |
// Handles calendar notifications
|
|
338 |
// -----------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
void CCalenUnifiedEditor::HandleNotification( TCalenNotification aNotification )
|
|
341 |
{
|
|
342 |
TRACE_ENTRY_POINT;
|
|
343 |
|
|
344 |
switch( aNotification )
|
|
345 |
{
|
|
346 |
case ECalenNotifyExternalDatabaseChanged:
|
|
347 |
{
|
|
348 |
iLastDbChangeNotification.UniversalTime();
|
|
349 |
}
|
|
350 |
break;
|
|
351 |
case ECalenNotifyEntryDeleted:
|
|
352 |
{
|
|
353 |
iEntryUiOutParams.iAction = MAgnEntryUi::EMeetingDeleted;
|
|
354 |
PIM_TRAPD_HANDLE( CloseFormWithoutActionsL() );
|
|
355 |
}
|
|
356 |
break;
|
|
357 |
case ECalenNotifyInstanceDeleted:
|
|
358 |
{
|
|
359 |
iEntryUiOutParams.iAction = MAgnEntryUi::EInstanceDeleted;
|
|
360 |
PIM_TRAPD_HANDLE( CloseFormWithoutActionsL() );
|
|
361 |
}
|
|
362 |
break;
|
|
363 |
case ECalenNotifyMapClosed:
|
|
364 |
{
|
|
365 |
// User has closed the map, store/update necessary details
|
|
366 |
PIM_TRAPD_HANDLE( UpdateLocationInfoToFormL() );
|
|
367 |
}
|
|
368 |
break;
|
|
369 |
case ECalenNotifyDeleteFailed:
|
|
370 |
{
|
|
371 |
iEntryUiOutParams.iAction = MAgnEntryUi::ENoAction;
|
|
372 |
}
|
|
373 |
break;
|
|
374 |
case ECalenNotifyAttachmentAdded:
|
|
375 |
case ECalenNotifyAttachmentRemoved:
|
|
376 |
{
|
|
377 |
// TODO: Uncomment this when enabling attachment support
|
|
378 |
PIM_TRAPD_HANDLE( UpdateAttachmentInfoToEditorL() );
|
|
379 |
}
|
|
380 |
break;
|
|
381 |
|
|
382 |
case ECalenNotifyEntryInstanceViewCreated:
|
|
383 |
break;
|
|
384 |
case ECalenNotifyCalendarFileDeleted:
|
|
385 |
{
|
|
386 |
TRAP_IGNORE(HandleCalendarDeleteL());
|
|
387 |
}
|
|
388 |
break;
|
|
389 |
default:
|
|
390 |
break;
|
|
391 |
}
|
|
392 |
TRACE_EXIT_POINT;
|
|
393 |
}
|
|
394 |
|
|
395 |
|
|
396 |
void CCalenUnifiedEditor::HandleCalendarDeleteL()
|
|
397 |
{
|
|
398 |
TPtrC fileNamePtr = iServices->Context().GetCalendarFileNameL();
|
|
399 |
TInt index = iUnifiedEditorControl->GetCalendarNameForEntryL(fileNamePtr);
|
|
400 |
if(index == KErrNotFound)
|
|
401 |
{
|
|
402 |
DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrDbConflictEntryDeleted );
|
|
403 |
iEntryUiOutParams.iAction = EMeetingDeleted;
|
|
404 |
TryExitL( KCalenButtonIdCloseForm );
|
|
405 |
}
|
|
406 |
|
|
407 |
}
|
|
408 |
|
|
409 |
// -----------------------------------------------------------------------------
|
|
410 |
// CCalenUnifiedEditor::InsertFieldL
|
|
411 |
// Inserts dialog line (form field) defined by aResourceI
|
|
412 |
// -----------------------------------------------------------------------------
|
|
413 |
//
|
|
414 |
void CCalenUnifiedEditor::InsertFieldL( TInt aResourceId, TInt aControlId,
|
|
415 |
TInt aPrevControlId )
|
|
416 |
{
|
|
417 |
TRACE_ENTRY_POINT;
|
|
418 |
|
|
419 |
CCoeControl* prevControl = Control( aPrevControlId );
|
|
420 |
__ASSERT_DEBUG( prevControl, User::Invariant() );
|
|
421 |
TInt pos = FindLineIndex( *prevControl );
|
|
422 |
pos = pos + 1;
|
|
423 |
InsertLineL( pos, aResourceId );
|
|
424 |
|
|
425 |
// We need to activate line, otherwise drawing doesn't work correctly
|
|
426 |
Line( aControlId )->ActivateL();
|
|
427 |
|
|
428 |
TRACE_EXIT_POINT;
|
|
429 |
}
|
|
430 |
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
// CCalenUnifiedEditor::HasField
|
|
433 |
// Check for field exists in unified editor
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
TBool CCalenUnifiedEditor::HasField( TInt aField )
|
|
437 |
{
|
|
438 |
TRACE_ENTRY_POINT;
|
|
439 |
TRACE_EXIT_POINT;
|
|
440 |
return ControlOrNull( aField ) != NULL;
|
|
441 |
}
|
|
442 |
|
|
443 |
// -----------------------------------------------------------------------------
|
|
444 |
// CCalenUnifiedEditor::UpdateFormL
|
|
445 |
// Update form. You can force update of form with this,
|
|
446 |
// if you modify some of the field values dynamically.
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
//
|
|
449 |
void CCalenUnifiedEditor::UpdateFormL()
|
|
450 |
{
|
|
451 |
TRACE_ENTRY_POINT;
|
|
452 |
|
|
453 |
UpdatePageL(ETrue);
|
|
454 |
|
|
455 |
TRACE_EXIT_POINT;
|
|
456 |
}
|
|
457 |
|
|
458 |
// --------------------------------------------------------------------------
|
|
459 |
// CreateCopyL
|
|
460 |
// Create a copy of the given entry.
|
|
461 |
// --------------------------------------------------------------------------
|
|
462 |
//
|
|
463 |
CCalEntry* CCalenUnifiedEditor::CreateCopyL( CCalEntry& aOther )
|
|
464 |
{
|
|
465 |
TRACE_ENTRY_POINT;
|
|
466 |
|
|
467 |
HBufC8* guid = aOther.UidL().AllocLC();
|
|
468 |
CCalEntry* entry;
|
|
469 |
if( aOther.RecurrenceIdL().TimeUtcL() != Time::NullTTime() )
|
|
470 |
{
|
|
471 |
entry = CCalEntry::NewL( aOther.EntryTypeL(), guid,
|
|
472 |
aOther.MethodL(),
|
|
473 |
aOther.SequenceNumberL(),
|
|
474 |
aOther.RecurrenceIdL(),
|
|
475 |
aOther.RecurrenceRangeL() );
|
|
476 |
}
|
|
477 |
else
|
|
478 |
{
|
|
479 |
entry = CCalEntry::NewL( aOther.EntryTypeL(), guid,
|
|
480 |
aOther.MethodL(),
|
|
481 |
aOther.SequenceNumberL() );
|
|
482 |
}
|
|
483 |
CleanupStack::Pop( guid ); // ownership was passed
|
|
484 |
CleanupStack::PushL( entry );
|
|
485 |
aOther.DescriptionL(); // make sure entry is fully loaded
|
|
486 |
entry->CopyFromL( aOther );
|
|
487 |
entry->DescriptionL(); // make sure entry is fully copied
|
|
488 |
CleanupStack::Pop( entry );
|
|
489 |
|
|
490 |
TRACE_EXIT_POINT;
|
|
491 |
return entry;
|
|
492 |
}
|
|
493 |
|
|
494 |
// -----------------------------------------------------------------------------
|
|
495 |
// CCalenUnifiedEditor::OkToExitL
|
|
496 |
// Handles exiting of the unified editor
|
|
497 |
// -----------------------------------------------------------------------------
|
|
498 |
//
|
|
499 |
TBool CCalenUnifiedEditor::OkToExitL( TInt aButtonId )
|
|
500 |
{
|
|
501 |
TRACE_ENTRY_POINT;
|
|
502 |
TBool isExitForm( ETrue );
|
|
503 |
TBool active = EFalse;
|
|
504 |
|
|
505 |
TCalCollectionId colId = iEditorDataHandler->CurrentDbCollectionId();
|
|
506 |
VerifyCollectionIdL(colId);
|
|
507 |
|
|
508 |
TInt newCtrlId=IdOfFocusControl();
|
|
509 |
switch ( aButtonId )
|
|
510 |
{
|
|
511 |
case EAknSoftkeyChange:
|
|
512 |
{
|
|
513 |
isExitForm=EFalse;
|
|
514 |
|
|
515 |
// to Handle MSK key 'Change'
|
|
516 |
if(newCtrlId == ECalenEditorEventType || newCtrlId == ECalenEditorRepeat
|
|
517 |
|| newCtrlId == ECalenEditorDBName
|
|
518 |
|| newCtrlId == ECalenEditorPriority)
|
|
519 |
{
|
|
520 |
|
|
521 |
CEikCaptionedControl* line=CurrentLine();
|
|
522 |
TInt type=line->iControlType;
|
|
523 |
TBool isPopUp=( type && EAknCtPopupField ) || ( type == EAknCtPopupFieldText );
|
|
524 |
if (isPopUp)
|
|
525 |
{
|
|
526 |
CAknPopupField* ctrl = static_cast<CAknPopupField*>( line->iControl );
|
|
527 |
ctrl->ActivateSelectionListL();
|
|
528 |
}
|
|
529 |
}
|
|
530 |
else if( newCtrlId == ECalenEditorReminder )
|
|
531 |
{
|
|
532 |
if( iUnifiedEditorControl->IsAlarmActiveInForm() )
|
|
533 |
{
|
|
534 |
SetAlarmFieldOnOffL( EFalse );
|
|
535 |
active = EFalse;
|
|
536 |
}
|
|
537 |
else
|
|
538 |
{
|
|
539 |
SetAlarmFieldOnOffL( ETrue );
|
|
540 |
active = ETrue;
|
|
541 |
}
|
|
542 |
iUnifiedEditorControl->CheckAlarmActive( active );
|
|
543 |
TryChangeFocusToL( ECalenEditorReminder );
|
|
544 |
}
|
|
545 |
else if( newCtrlId == ECalenEditorAllDayItem )
|
|
546 |
{
|
|
547 |
if( iUnifiedEditorControl->IsAllDayEvent() )
|
|
548 |
{
|
|
549 |
SetAllDayFieldL( EFalse );
|
|
550 |
active = EFalse;
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
SetAllDayFieldL( ETrue );
|
|
555 |
active = ETrue;
|
|
556 |
}
|
|
557 |
iUnifiedEditorControl->SetAllDayEventL( active );
|
|
558 |
|
|
559 |
}
|
|
560 |
break;
|
|
561 |
}
|
|
562 |
case EAknSoftkeyOptions:
|
|
563 |
{
|
|
564 |
DisplayMenuL();
|
|
565 |
isExitForm = EFalse;
|
|
566 |
break;
|
|
567 |
}
|
|
568 |
case KCalenButtonIdCloseForm:
|
|
569 |
{
|
|
570 |
// Do nothing, just close.
|
|
571 |
// This is called when entry is deleted
|
|
572 |
// via menu or clearing texts
|
|
573 |
isExitForm = ETrue;
|
|
574 |
break;
|
|
575 |
}
|
|
576 |
case ECalenCmdCloseDialog:
|
|
577 |
{
|
|
578 |
// Forced close of the dialog when calendar is reopened from the
|
|
579 |
// command line. We do not want to update calendars stored focus
|
|
580 |
// in case we override any command line parameters
|
|
581 |
// Intentional fall through to EEikBidCancel below
|
|
582 |
iEntryUiOutParams.iAction = ENoAction;
|
|
583 |
iEntryUiOutParams.iSpare = 0;
|
|
584 |
MCalenContext& context = iServices->Context();
|
|
585 |
HBufC* fileNamePtr = context.GetCalAlarmEntryFileNameL();
|
|
586 |
TCalLocalUid localUid = context.CalAlarmLocalUidL();
|
|
587 |
if (fileNamePtr != NULL && !fileNamePtr->CompareF(iGlobalData->GetCalFileNameForCollectionId(context.InstanceId().iColId))
|
|
588 |
&& localUid == context.InstanceId().iEntryLocalUid)
|
|
589 |
{
|
|
590 |
context.ResetCalAlarmEntryFileName();
|
|
591 |
break;
|
|
592 |
}
|
|
593 |
// Fall through...
|
|
594 |
}
|
|
595 |
case ECalenEditSeries:
|
|
596 |
case ECalenEditOccurrence:
|
|
597 |
case EAknCmdExit:
|
|
598 |
case EAknSoftkeyExit:
|
|
599 |
case EEikBidCancel:
|
|
600 |
{
|
|
601 |
// EEikBidCancel is called when Red End key is pressed or
|
|
602 |
// MMC card is taken out or application is killed via Swap Window
|
|
603 |
// EAknCmdExit is called, when user selects Options->Exit
|
|
604 |
// (see OnCmdExit)
|
|
605 |
|
|
606 |
// At this point, CAknShutter fires us EEikBidCancel key events
|
|
607 |
// offering it to our dialog control. Firing key events continues
|
|
608 |
// until our dialog is closed, which is detected by FW.
|
|
609 |
|
|
610 |
// Entry can't be stored if EntryView does not exist.
|
|
611 |
// Will exit and lose some data if entry was really edited.
|
|
612 |
|
|
613 |
if( iServices->EntryViewL(colId) )
|
|
614 |
{
|
|
615 |
PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
|
|
616 |
iCheck = EFalse;
|
|
617 |
}
|
|
618 |
if(EAknSoftkeyExit == aButtonId)
|
|
619 |
iServices->IssueCommandL(aButtonId);
|
|
620 |
|
|
621 |
break;
|
|
622 |
}
|
|
623 |
case EAknSoftkeyDone:
|
|
624 |
{
|
|
625 |
// Need an entry view before starting to
|
|
626 |
// handle the done button.
|
|
627 |
if( iServices->EntryViewL(colId) )
|
|
628 |
{
|
|
629 |
isExitForm = HandleDoneL();
|
|
630 |
}
|
|
631 |
else
|
|
632 |
{
|
|
633 |
// The entry view has not been constructed yet
|
|
634 |
//iCreatingEntryView = EFalse;
|
|
635 |
isExitForm = EFalse;
|
|
636 |
}
|
|
637 |
}
|
|
638 |
break;
|
|
639 |
case ECalenGetLocation:
|
|
640 |
{
|
|
641 |
// Issue command to framework to launch the map
|
|
642 |
isExitForm=EFalse;
|
|
643 |
ReadPlaceFromEditorL(); // to remove any picture characters in location string
|
|
644 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
645 |
GetEdwinText(location, ECalenEditorPlace);
|
|
646 |
CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
|
|
647 |
if(geoValue)
|
|
648 |
{
|
|
649 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
650 |
landmark->SetLandmarkNameL(location);
|
|
651 |
TReal latitude;
|
|
652 |
TReal longitude;
|
|
653 |
geoValue->GetLatLong(latitude, longitude);
|
|
654 |
TPosition position;
|
|
655 |
position.SetCoordinate(latitude, longitude);
|
|
656 |
landmark->SetPositionL(position);
|
|
657 |
delete geoValue;
|
|
658 |
MCalenContext& context = iServices->Context();
|
|
659 |
context.SetLandMark(landmark);
|
|
660 |
}
|
|
661 |
else if(location.Length())
|
|
662 |
{
|
|
663 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
664 |
landmark->SetLandmarkNameL(location);
|
|
665 |
MCalenContext& context = iServices->Context();
|
|
666 |
context.SetLandMark(landmark);
|
|
667 |
}
|
|
668 |
iServices->IssueCommandL(ECalenGetLocation);
|
|
669 |
}
|
|
670 |
break;
|
|
671 |
default:
|
|
672 |
isExitForm = EFalse;
|
|
673 |
break;
|
|
674 |
}
|
|
675 |
TRACE_EXIT_POINT;
|
|
676 |
return isExitForm;
|
|
677 |
}
|
|
678 |
|
|
679 |
// -----------------------------------------------------------------------------
|
|
680 |
// CCalenUnifiedEditor::OfferKeyEventL
|
|
681 |
// Handles key events
|
|
682 |
// -----------------------------------------------------------------------------
|
|
683 |
//
|
|
684 |
TKeyResponse CCalenUnifiedEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
685 |
TEventCode aType )
|
|
686 |
{
|
|
687 |
|
|
688 |
TRACE_ENTRY_POINT;
|
|
689 |
TKeyResponse keyResponse( EKeyWasNotConsumed );
|
|
690 |
TInt ctrlid=IdOfFocusControl();
|
|
691 |
|
|
692 |
/* If KeyCallBack has not been called after construction
|
|
693 |
* (= initialization of iIdle) call it now to
|
|
694 |
* handle key event queue.
|
|
695 |
*/
|
|
696 |
if ( iIdle )
|
|
697 |
{
|
|
698 |
KeyCallBack( this );
|
|
699 |
}
|
|
700 |
|
|
701 |
if ( aType == EEventKey )
|
|
702 |
{
|
|
703 |
switch ( aKeyEvent.iCode )
|
|
704 |
{
|
|
705 |
case EKeyOK:
|
|
706 |
// TODO: Uncomment this when enabling attachment support
|
|
707 |
|
|
708 |
if(ctrlid == ECalenEditorAttachment)
|
|
709 |
{
|
|
710 |
if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems())
|
|
711 |
{
|
|
712 |
iServices->IssueCommandL( ECalenViewAttachmentList );
|
|
713 |
}
|
|
714 |
else
|
|
715 |
{
|
|
716 |
iServices->IssueCommandL( ECalenAddAttachment );
|
|
717 |
}
|
|
718 |
}
|
|
719 |
break;
|
|
720 |
case EKeyEscape:
|
|
721 |
// Calendar relaunched from cmd line - close viewer
|
|
722 |
// NOTE: This was changed from EAknCmdExit to ECalenCmdCloseDialog since launching
|
|
723 |
// the calanedar from cmd line or opening missed alarm view while calendar editor is
|
|
724 |
// opened is closing the application.
|
|
725 |
TryExitL( ECalenCmdCloseDialog );
|
|
726 |
keyResponse = EKeyWasConsumed;
|
|
727 |
break;
|
|
728 |
case EKeyEnter: // For Enter key
|
|
729 |
{
|
|
730 |
if(ctrlid == ECalenEditorAttachment)
|
|
731 |
{
|
|
732 |
if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems())
|
|
733 |
{
|
|
734 |
iServices->IssueCommandL( ECalenViewAttachmentList );
|
|
735 |
}
|
|
736 |
else
|
|
737 |
{
|
|
738 |
iServices->IssueCommandL( ECalenAddAttachment );
|
|
739 |
}
|
|
740 |
}
|
|
741 |
keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); // Let framework handle the key event
|
|
742 |
}
|
|
743 |
break;
|
|
744 |
case EKeyDelete: // For Delete key
|
|
745 |
{
|
|
746 |
keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); // Let framework handle the key event
|
|
747 |
}
|
|
748 |
break;
|
|
749 |
case EKeyBackspace: // For back space character
|
|
750 |
{
|
|
751 |
if(ctrlid == ECalenEditorPlace || ECalenEditorSubject)
|
|
752 |
{
|
|
753 |
keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType);
|
|
754 |
}
|
|
755 |
break;
|
|
756 |
}
|
|
757 |
case EKeyLeftArrow:
|
|
758 |
case EKeyRightArrow:
|
|
759 |
{
|
|
760 |
if( ECalenEditorEventType == IdOfFocusControl() )
|
|
761 |
{
|
|
762 |
keyResponse = EKeyWasConsumed;
|
|
763 |
}
|
|
764 |
else
|
|
765 |
{
|
|
766 |
keyResponse = CAknForm::OfferKeyEventL( aKeyEvent, aType );
|
|
767 |
}
|
|
768 |
}
|
|
769 |
break;
|
|
770 |
|
|
771 |
default:
|
|
772 |
{
|
|
773 |
keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType);
|
|
774 |
}
|
|
775 |
break;
|
|
776 |
}
|
|
777 |
}
|
|
778 |
|
|
779 |
// For handling geokeys on corolla hardware
|
|
780 |
// For Add location hard key
|
|
781 |
if( aKeyEvent.iScanCode == EStdKeyApplication1C && aType == EEventKeyUp )
|
|
782 |
{
|
|
783 |
if(CCalenLocationUtil::IsMapProviderAvailableL())
|
|
784 |
{
|
|
785 |
TryChangeFocusToL(ECalenEditorPlace);
|
|
786 |
ReadPlaceFromEditorL(); // to remove any picture characters in location string
|
|
787 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
788 |
GetEdwinText(location, ECalenEditorPlace);
|
|
789 |
CPosLandmark* landmark = NULL;
|
|
790 |
if(location.Length())
|
|
791 |
{
|
|
792 |
landmark = CPosLandmark::NewL();
|
|
793 |
landmark->SetLandmarkNameL(location);
|
|
794 |
}
|
|
795 |
CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
|
|
796 |
if(geoValue)
|
|
797 |
{
|
|
798 |
if(!landmark)
|
|
799 |
{
|
|
800 |
landmark = CPosLandmark::NewL();
|
|
801 |
}
|
|
802 |
TReal latitude;
|
|
803 |
TReal longitude;
|
|
804 |
geoValue->GetLatLong(latitude, longitude);
|
|
805 |
TPosition position;
|
|
806 |
position.SetCoordinate(latitude, longitude);
|
|
807 |
landmark->SetPositionL(position);
|
|
808 |
delete geoValue;
|
|
809 |
}
|
|
810 |
MCalenContext& context = iServices->Context();
|
|
811 |
context.SetLandMark(landmark);
|
|
812 |
iServices->IssueCommandL(ECalenGetLocation);
|
|
813 |
keyResponse = EKeyWasConsumed;
|
|
814 |
}
|
|
815 |
}
|
|
816 |
// For Show location hard key
|
|
817 |
else if( aKeyEvent.iScanCode == EStdKeyApplication1B && aType == EEventKeyUp )
|
|
818 |
{
|
|
819 |
ReadPlaceFromEditorL();
|
|
820 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
821 |
GetEdwinText(location, ECalenEditorPlace);
|
|
822 |
if(CCalenLocationUtil::IsMapProviderAvailableL())
|
|
823 |
{
|
|
824 |
TryChangeFocusToL(ECalenEditorPlace);
|
|
825 |
MCalenContext& context = iServices->Context();
|
|
826 |
CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
|
|
827 |
if(geoValue)
|
|
828 |
{
|
|
829 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
830 |
landmark->SetLandmarkNameL(location);
|
|
831 |
TReal latitude;
|
|
832 |
TReal longitude;
|
|
833 |
geoValue->GetLatLong(latitude, longitude);
|
|
834 |
TPosition position;
|
|
835 |
position.SetCoordinate(latitude, longitude);
|
|
836 |
landmark->SetPositionL(position);
|
|
837 |
context.SetLandMark(landmark);
|
|
838 |
iServices->IssueCommandL(ECalenShowLocation);
|
|
839 |
delete geoValue;
|
|
840 |
}
|
|
841 |
else if(location.Length())
|
|
842 |
{
|
|
843 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
844 |
landmark->SetLandmarkNameL(location);
|
|
845 |
context.SetLandMark(landmark);
|
|
846 |
isReplaceLocation = ETrue;
|
|
847 |
iServices->IssueCommandL(ECalenGetLocation);
|
|
848 |
}
|
|
849 |
keyResponse = EKeyWasConsumed;
|
|
850 |
}
|
|
851 |
}
|
|
852 |
|
|
853 |
// Swallow all other keyevents to prevent the active container processing them.
|
|
854 |
keyResponse = EKeyWasConsumed;
|
|
855 |
|
|
856 |
TRACE_EXIT_POINT;
|
|
857 |
return keyResponse;
|
|
858 |
}
|
|
859 |
|
|
860 |
// -----------------------------------------------------------------------------
|
|
861 |
// CCalenUnifiedEditor::HandleCompletionOfTransactionL
|
|
862 |
// Is called when fep transaction has been completed. If this
|
|
863 |
// happens before key event queue has been simulated, events in
|
|
864 |
// key buffer must be ignored. If key events are simulated after this
|
|
865 |
// result is duplicate characters or wrong order of characters.
|
|
866 |
// (other items were commented in a header).
|
|
867 |
// -----------------------------------------------------------------------------
|
|
868 |
void CCalenUnifiedEditor::HandleCompletionOfTransactionL()
|
|
869 |
{
|
|
870 |
TRACE_ENTRY_POINT;
|
|
871 |
if( iIdle )
|
|
872 |
{
|
|
873 |
delete iIdle;
|
|
874 |
iIdle = NULL;
|
|
875 |
iServices->ResetKeyEventQueue();/*ignore all events*/
|
|
876 |
}
|
|
877 |
TRACE_EXIT_POINT;
|
|
878 |
}
|
|
879 |
|
|
880 |
// -----------------------------------------------------------------------------
|
|
881 |
// CCalenUnifiedEditor::KeyCallBack
|
|
882 |
// Handles key events in key event queue
|
|
883 |
// (other items were commented in a header).
|
|
884 |
// -----------------------------------------------------------------------------
|
|
885 |
TInt CCalenUnifiedEditor::KeyCallBack( TAny *aSelf )
|
|
886 |
{
|
|
887 |
TRACE_ENTRY_POINT;
|
|
888 |
CCalenUnifiedEditor *self = static_cast<CCalenUnifiedEditor*>( aSelf );
|
|
889 |
delete self->iIdle;
|
|
890 |
self->iIdle = NULL;
|
|
891 |
|
|
892 |
TKeyEvent event;
|
|
893 |
TEventCode type;
|
|
894 |
|
|
895 |
while( self->iServices->GetQueuedKeyEvent( event, type ) )
|
|
896 |
{
|
|
897 |
TRAPD(err,
|
|
898 |
self->iCoeEnv->SimulateKeyEventL( event, type );
|
|
899 |
);
|
|
900 |
if ( err != KErrNone )
|
|
901 |
{
|
|
902 |
CEikEdwin* edwin = static_cast<CEikEdwin*>( self->Control( self->IdOfFocusControl() ) );
|
|
903 |
edwin->CancelFepTransaction(); // indispensable to avoid crash
|
|
904 |
self->iCoeEnv->HandleError( err );
|
|
905 |
}
|
|
906 |
}
|
|
907 |
TRACE_EXIT_POINT;
|
|
908 |
return EFalse;
|
|
909 |
}
|
|
910 |
|
|
911 |
// -----------------------------------------------------------------------------
|
|
912 |
// CCalenUnifiedEditor::LocaleCallback
|
|
913 |
// This function is called when a locale(or today) is changed.
|
|
914 |
// -----------------------------------------------------------------------------
|
|
915 |
//
|
|
916 |
TInt CCalenUnifiedEditor::LocaleCallback( TAny* aThisPtr ) // A CCalenFormBase pointer
|
|
917 |
{
|
|
918 |
TRACE_ENTRY_POINT;
|
|
919 |
CCalenUnifiedEditor* unifiededitor = static_cast<CCalenUnifiedEditor*>( aThisPtr );
|
|
920 |
|
|
921 |
if( unifiededitor->iIgnoreFirstLocaleChange )
|
|
922 |
{
|
|
923 |
// Ignore the first locale change so we don't rebuild for no reason.
|
|
924 |
unifiededitor->iIgnoreFirstLocaleChange = EFalse;
|
|
925 |
TRACE_ENTRY_POINT;
|
|
926 |
return EFalse;
|
|
927 |
}
|
|
928 |
|
|
929 |
TRACE_EXIT_POINT;
|
|
930 |
return unifiededitor->HandleLocaleChange( unifiededitor->iLocaleChangeNotifier->Change() );
|
|
931 |
}
|
|
932 |
|
|
933 |
// -----------------------------------------------------------------------------
|
|
934 |
// CCalenUnifiedEditor::HandleLocaleChange
|
|
935 |
// CCalenUnifiedEditor::LocaleCallback() methods calls this method
|
|
936 |
// -----------------------------------------------------------------------------
|
|
937 |
//
|
|
938 |
TInt CCalenUnifiedEditor::HandleLocaleChange( TInt aChange )
|
|
939 |
{
|
|
940 |
TRACE_ENTRY_POINT;
|
|
941 |
|
|
942 |
PIM_TRAPD_HANDLE( DoHandleLocaleChangeL( aChange ) );
|
|
943 |
|
|
944 |
TRACE_EXIT_POINT;
|
|
945 |
return FALSE;
|
|
946 |
}
|
|
947 |
|
|
948 |
// -----------------------------------------------------------------------------
|
|
949 |
// CCalenUnifiedEditor::DoHandleLocaleChange
|
|
950 |
// HandleLocaleChange calls this function
|
|
951 |
// -----------------------------------------------------------------------------
|
|
952 |
//
|
|
953 |
void CCalenUnifiedEditor::DoHandleLocaleChangeL( TInt aChange )
|
|
954 |
{
|
|
955 |
TRACE_ENTRY_POINT;
|
|
956 |
|
|
957 |
if( aChange & EChangesSystemTime )
|
|
958 |
{
|
|
959 |
// System time zone change. Recreate the handler, so that
|
|
960 |
// the new local time is shown in the viewer.
|
|
961 |
if( !IsCreatingNewEntry() )
|
|
962 |
{
|
|
963 |
if( !iEditorDataHandler->IsEditedL() )
|
|
964 |
{
|
|
965 |
delete iEditorDataHandler;
|
|
966 |
iEditorDataHandler = NULL;
|
|
967 |
iEditorDataHandler = CCalenEditorDataHandler::NewL( iEditedCalEntry,
|
|
968 |
iEntryUiInParams.iInstanceDate,
|
|
969 |
IsCreatingNewEntry(),
|
|
970 |
MaxTextEditorLength(),
|
|
971 |
*iServices ,iCollectionIds);
|
|
972 |
}
|
|
973 |
else
|
|
974 |
{
|
|
975 |
iEditorDataHandler->ResetOriginalDataL();
|
|
976 |
}
|
|
977 |
}
|
|
978 |
iUnifiedEditorControl->SetDataToEditorL(ETrue);
|
|
979 |
}
|
|
980 |
|
|
981 |
if ( aChange & EChangesLocale )
|
|
982 |
{
|
|
983 |
iUnifiedEditorControl->ReadDataFromEditorL( ETrue );
|
|
984 |
iUnifiedEditorControl->UpdateLinesOnLocaleChangeL();
|
|
985 |
}
|
|
986 |
TRACE_EXIT_POINT;
|
|
987 |
}
|
|
988 |
|
|
989 |
// -----------------------------------------------------------------------------
|
|
990 |
// CCalenUnifiedEditor::PreLayoutDynInitL
|
|
991 |
// Initializes the dialog's controls before the dialog is sized
|
|
992 |
// -----------------------------------------------------------------------------
|
|
993 |
//
|
|
994 |
void CCalenUnifiedEditor::PreLayoutDynInitL()
|
|
995 |
{
|
|
996 |
TRACE_ENTRY_POINT;
|
|
997 |
|
|
998 |
iUnifiedEditorControl->MakeUnifiedEditorL();
|
|
999 |
// Hides Entry type and Calendar Field for exceptional entry/single
|
|
1000 |
// instance of recurrent entry.
|
|
1001 |
HideFieldsForEditSingleInstanceL();
|
|
1002 |
|
|
1003 |
TRACE_EXIT_POINT;
|
|
1004 |
}
|
|
1005 |
|
|
1006 |
// -----------------------------------------------------------------------------
|
|
1007 |
// CCalenUnifiedEditor::PostLayoutDynInitL
|
|
1008 |
// Initializes the dialog's controls after the dialog has been sized
|
|
1009 |
// -----------------------------------------------------------------------------
|
|
1010 |
//
|
|
1011 |
void CCalenUnifiedEditor::PostLayoutDynInitL()
|
|
1012 |
{
|
|
1013 |
TRACE_ENTRY_POINT;
|
|
1014 |
|
|
1015 |
SetEditableL(ETrue);
|
|
1016 |
|
|
1017 |
TCallBack callback( LocaleCallback, this );
|
|
1018 |
iLocaleChangeNotifier =
|
|
1019 |
CEnvironmentChangeNotifier::NewL( EActivePriorityLogonA, callback );
|
|
1020 |
|
|
1021 |
iLocaleChangeNotifier->Start();
|
|
1022 |
|
|
1023 |
TRACE_EXIT_POINT;
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
// -----------------------------------------------------------------------------
|
|
1027 |
// CCalenUnifiedEditor::HandleControlStateChangeL
|
|
1028 |
// IHandles a state change in the control with id aControlId.
|
|
1029 |
// -----------------------------------------------------------------------------
|
|
1030 |
//
|
|
1031 |
void CCalenUnifiedEditor::HandleControlStateChangeL( TInt aControlId )
|
|
1032 |
{
|
|
1033 |
TRACE_ENTRY_POINT;
|
|
1034 |
|
|
1035 |
iUnifiedEditorControl->HandleControlStateChangeL( aControlId );
|
|
1036 |
|
|
1037 |
TRACE_EXIT_POINT;
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
// -----------------------------------------------------------------------------
|
|
1041 |
// CCalenUnifiedEditor::PrepareForFocusTransitionL
|
|
1042 |
// Tries to change focus to the specified line.
|
|
1043 |
// -----------------------------------------------------------------------------
|
|
1044 |
//
|
|
1045 |
void CCalenUnifiedEditor::PrepareForFocusTransitionL()
|
|
1046 |
{
|
|
1047 |
TRACE_ENTRY_POINT;
|
|
1048 |
|
|
1049 |
CEikDialog::PrepareForFocusTransitionL();
|
|
1050 |
|
|
1051 |
iUnifiedEditorControl->PrepareForFocusTransitionL( IdOfFocusControl() );
|
|
1052 |
|
|
1053 |
TRACE_EXIT_POINT;
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
// -----------------------------------------------------------------------------
|
|
1057 |
// CCalenUnifiedEditor::ActivateL
|
|
1058 |
// Try to change item focus here
|
|
1059 |
// -----------------------------------------------------------------------------
|
|
1060 |
//
|
|
1061 |
void CCalenUnifiedEditor::ActivateL()
|
|
1062 |
{
|
|
1063 |
TRACE_ENTRY_POINT;
|
|
1064 |
|
|
1065 |
CAknForm::ActivateL();
|
|
1066 |
TryChangeFocusToL( ECalenEditorSubject );
|
|
1067 |
|
|
1068 |
TRACE_EXIT_POINT;
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
// -----------------------------------------------------------------------------
|
|
1072 |
// CCalenUnifiedEditor::ProcessCommandL
|
|
1073 |
// Handles editor menu commands
|
|
1074 |
// -----------------------------------------------------------------------------
|
|
1075 |
//
|
|
1076 |
void CCalenUnifiedEditor::ProcessCommandL( TInt aCommandId )
|
|
1077 |
{
|
|
1078 |
TRACE_ENTRY_POINT;
|
|
1079 |
|
|
1080 |
HideMenu();
|
|
1081 |
switch( aCommandId )
|
|
1082 |
{
|
|
1083 |
case ECalenCmdCancel:
|
|
1084 |
OnCmdCancelL();
|
|
1085 |
break;
|
|
1086 |
case ECalenDeleteCurrentEntry:
|
|
1087 |
OnCmdDeleteNoteL();
|
|
1088 |
break;
|
|
1089 |
case EAknCmdExit:
|
|
1090 |
case EAknSoftkeyExit:
|
|
1091 |
OnCmdExitL(aCommandId);
|
|
1092 |
break;
|
|
1093 |
case EAknCmdHelp:
|
|
1094 |
OnCmdHelpL();
|
|
1095 |
break;
|
|
1096 |
case ECalenGetLocation:
|
|
1097 |
{
|
|
1098 |
ReadPlaceFromEditorL(); // to remove any picture characters in location string
|
|
1099 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
1100 |
GetEdwinText(location, ECalenEditorPlace);
|
|
1101 |
CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
|
|
1102 |
if(geoValue)
|
|
1103 |
{
|
|
1104 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
1105 |
landmark->SetLandmarkNameL(location);
|
|
1106 |
TReal latitude;
|
|
1107 |
TReal longitude;
|
|
1108 |
geoValue->GetLatLong(latitude, longitude);
|
|
1109 |
TPosition position;
|
|
1110 |
position.SetCoordinate(latitude, longitude);
|
|
1111 |
landmark->SetPositionL(position);
|
|
1112 |
delete geoValue;
|
|
1113 |
MCalenContext& context = iServices->Context();
|
|
1114 |
context.SetLandMark(landmark);
|
|
1115 |
}
|
|
1116 |
else if(location.Length())
|
|
1117 |
{
|
|
1118 |
AknTextUtils::ReplaceCharacters(location, KReplaceWhitespaceChars, TChar(' '));
|
|
1119 |
CPosLandmark* landmark = CPosLandmark::NewL();
|
|
1120 |
landmark->SetLandmarkNameL(location);
|
|
1121 |
MCalenContext& context = iServices->Context();
|
|
1122 |
context.SetLandMark( landmark );
|
|
1123 |
}
|
|
1124 |
iServices->IssueCommandL( ECalenGetLocation );
|
|
1125 |
}
|
|
1126 |
break;
|
|
1127 |
case ECalenCmdAddAttachment:
|
|
1128 |
{
|
|
1129 |
// TODO: Uncomment this when enabling attachment support
|
|
1130 |
iServices->IssueCommandL( ECalenAddAttachment );
|
|
1131 |
}
|
|
1132 |
break;
|
|
1133 |
case ECalenCmdViewAttachmentList:
|
|
1134 |
{
|
|
1135 |
iServices->IssueCommandL(ECalenViewAttachmentList);
|
|
1136 |
}
|
|
1137 |
break;
|
|
1138 |
case ECalenCmdRemoveAttachment:
|
|
1139 |
{
|
|
1140 |
// TODO: Uncomment this when enabling attachment support
|
|
1141 |
|
|
1142 |
TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems();
|
|
1143 |
|
|
1144 |
if(Edited().AttachmentCount() || attachmentCount)
|
|
1145 |
{
|
|
1146 |
iServices->IssueCommandL( ECalenRemoveAttachment );
|
|
1147 |
}
|
|
1148 |
}
|
|
1149 |
break;
|
|
1150 |
default:
|
|
1151 |
{
|
|
1152 |
if( iUnifiedEditorControl->Description() )
|
|
1153 |
{
|
|
1154 |
iUnifiedEditorControl->Description()->ProcessCommandL( aCommandId );
|
|
1155 |
}
|
|
1156 |
}
|
|
1157 |
// NOP, pass command through (for FEP etc.)
|
|
1158 |
break;
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
TRACE_EXIT_POINT;
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
//Single click integration
|
|
1165 |
// -----------------------------------------------------------------------------
|
|
1166 |
// CCalenUnifiedEditor::HandleDialogPageEventL
|
|
1167 |
// -----------------------------------------------------------------------------
|
|
1168 |
//
|
|
1169 |
void CCalenUnifiedEditor::HandleDialogPageEventL( TInt aEventID )
|
|
1170 |
{
|
|
1171 |
CAknForm::HandleDialogPageEventL( aEventID );
|
|
1172 |
if ( aEventID == MEikDialogPageObserver::EDialogPageTapped )
|
|
1173 |
{
|
|
1174 |
TInt focusControl( IdOfFocusControl() );
|
|
1175 |
if ( focusControl == ECalenEditorAttachment
|
|
1176 |
|| focusControl == ECalenEditorDescription )
|
|
1177 |
{
|
|
1178 |
|
|
1179 |
|
|
1180 |
switch ( focusControl )
|
|
1181 |
{
|
|
1182 |
case ECalenEditorAttachment:
|
|
1183 |
{
|
|
1184 |
|
|
1185 |
if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems())
|
|
1186 |
{
|
|
1187 |
ProcessCommandL( ECalenCmdViewAttachmentList );
|
|
1188 |
}
|
|
1189 |
else
|
|
1190 |
{
|
|
1191 |
ProcessCommandL( ECalenCmdAddAttachment );
|
|
1192 |
}
|
|
1193 |
break;
|
|
1194 |
}
|
|
1195 |
|
|
1196 |
case ECalenEditorDescription:
|
|
1197 |
{
|
|
1198 |
// CEikEdwin* edwin = static_cast<CEikEdwin*>( Control( focusControl ) );
|
|
1199 |
// if ( edwin && edwin->Text()->DocumentLength() == 0 )
|
|
1200 |
// {
|
|
1201 |
// ProcessCommandL( ECalenCmdAddDescription );
|
|
1202 |
// }
|
|
1203 |
// else
|
|
1204 |
// {
|
|
1205 |
// ProcessCommandL( ECalenCmdShowDescription );
|
|
1206 |
// }
|
|
1207 |
iAsyncCallback->CallBack();
|
|
1208 |
break;
|
|
1209 |
}
|
|
1210 |
|
|
1211 |
default:
|
|
1212 |
{
|
|
1213 |
break;
|
|
1214 |
}
|
|
1215 |
}
|
|
1216 |
|
|
1217 |
}
|
|
1218 |
else if ( focusControl == ECalenEditorAllDayItem )
|
|
1219 |
{
|
|
1220 |
// Tap on AllDay field, Switch the status of AllDay field
|
|
1221 |
iUnifiedEditorControl->SetAllDayEventL(
|
|
1222 |
!( iUnifiedEditorControl->IsAllDayEvent() ) );
|
|
1223 |
}
|
|
1224 |
else if ( focusControl == ECalenEditorReminder )
|
|
1225 |
{
|
|
1226 |
TBool active;
|
|
1227 |
if( iUnifiedEditorControl->IsAlarmActiveInForm() )
|
|
1228 |
{
|
|
1229 |
SetAlarmFieldOnOffL( EFalse );
|
|
1230 |
active = EFalse;
|
|
1231 |
}
|
|
1232 |
else
|
|
1233 |
{
|
|
1234 |
SetAlarmFieldOnOffL( ETrue );
|
|
1235 |
active = ETrue;
|
|
1236 |
}
|
|
1237 |
iUnifiedEditorControl->CheckAlarmActive( active );
|
|
1238 |
TryChangeFocusToL( ECalenEditorReminder );
|
|
1239 |
}
|
|
1240 |
}
|
|
1241 |
}
|
|
1242 |
|
|
1243 |
|
|
1244 |
TInt CCalenUnifiedEditor::AsyncProcessCommandL( TAny* aThisPtr )
|
|
1245 |
{
|
|
1246 |
TInt focusControl( static_cast<CCalenUnifiedEditor*>(aThisPtr)->IdOfFocusControl() );
|
|
1247 |
if(focusControl == ECalenEditorDescription)
|
|
1248 |
{
|
|
1249 |
CEikEdwin* edwin = static_cast<CEikEdwin*>( static_cast<CCalenUnifiedEditor*>(aThisPtr)->Control( focusControl ) );
|
|
1250 |
if ( edwin && edwin->Text()->DocumentLength() == 0 )
|
|
1251 |
{
|
|
1252 |
static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdAddDescription);
|
|
1253 |
}
|
|
1254 |
else
|
|
1255 |
{
|
|
1256 |
static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdShowDescription);
|
|
1257 |
}
|
|
1258 |
}
|
|
1259 |
return 0;
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
|
|
1263 |
// -----------------------------------------------------------------------------
|
|
1264 |
// CCalenUnifiedEditor::HandleResourceChange
|
|
1265 |
// Handdles the resource change
|
|
1266 |
// -----------------------------------------------------------------------------
|
|
1267 |
//
|
|
1268 |
void CCalenUnifiedEditor::HandleResourceChange( TInt aType )
|
|
1269 |
{
|
|
1270 |
TRACE_ENTRY_POINT;
|
|
1271 |
|
|
1272 |
if( aType == KEikDynamicLayoutVariantSwitch )
|
|
1273 |
{
|
|
1274 |
CAknForm::HandleResourceChange( aType );
|
|
1275 |
}
|
|
1276 |
|
|
1277 |
CCoeControl::HandleResourceChange( aType );
|
|
1278 |
|
|
1279 |
TRACE_EXIT_POINT;
|
|
1280 |
}
|
|
1281 |
|
|
1282 |
// -----------------------------------------------------------------------------
|
|
1283 |
// CCalenUnifiedEditor::DynInitMenuPaneL
|
|
1284 |
// Dynamic initialistaion of menu pane
|
|
1285 |
// -----------------------------------------------------------------------------
|
|
1286 |
//
|
|
1287 |
void CCalenUnifiedEditor::DynInitMenuPaneL(
|
|
1288 |
TInt aResourceId,
|
|
1289 |
CEikMenuPane* aMenuPane )
|
|
1290 |
{
|
|
1291 |
TInt ctrlid=IdOfFocusControl();
|
|
1292 |
|
|
1293 |
switch ( aResourceId )
|
|
1294 |
{
|
|
1295 |
case R_CALEN_UNIFIED_EDITOR_MENUPANE:
|
|
1296 |
{
|
|
1297 |
// Here we have to call other classes DynInitMenuPaneL
|
|
1298 |
// in that order that we want items to appear!
|
|
1299 |
if( ctrlid == ECalenEditorDescription )
|
|
1300 |
{
|
|
1301 |
iUnifiedEditorControl->Description()->DynInitMenuPaneL(
|
|
1302 |
aResourceId,
|
|
1303 |
aMenuPane );
|
|
1304 |
}
|
|
1305 |
|
|
1306 |
// TODO: Uncomment this when enabling attachment support
|
|
1307 |
|
|
1308 |
if( ctrlid == ECalenEditorAttachment )
|
|
1309 |
{
|
|
1310 |
aMenuPane->AddMenuItemsL( R_CALEN_EDITOR_ATTACHMENTS_MENUPANE );
|
|
1311 |
if( !EntryHasAttachments() )
|
|
1312 |
{
|
|
1313 |
aMenuPane->DeleteMenuItem( ECalenCmdRemoveAttachment );
|
|
1314 |
}
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
aMenuPane->AddMenuItemsL( R_CALEN_UNIFIED_EDITOR_DEFAULT_MENUPANE );
|
|
1318 |
|
|
1319 |
if( (iEntryType == CCalEntry::ETodo) || !(CCalenLocationUtil::IsMapProviderAvailableL()) )
|
|
1320 |
{
|
|
1321 |
aMenuPane->DeleteMenuItem( ECalenGetLocation );
|
|
1322 |
}
|
|
1323 |
|
|
1324 |
if( IsCreatingNewEntry() )
|
|
1325 |
{
|
|
1326 |
// Always remove the `Discard Changes' option from the menu-
|
|
1327 |
// pane when a new entry is being created.
|
|
1328 |
aMenuPane->DeleteMenuItem( ECalenCmdCancel );
|
|
1329 |
}
|
|
1330 |
else
|
|
1331 |
{
|
|
1332 |
// While editing, first check if any of the fields have changed.
|
|
1333 |
// Then check if the entry type field has changed.
|
|
1334 |
if( !EditorDataHandler().IsEditedL() )
|
|
1335 |
{
|
|
1336 |
if( !EditorDataHandler().IsEntryTypeEdited() )
|
|
1337 |
{
|
|
1338 |
aMenuPane->DeleteMenuItem( ECalenCmdCancel );
|
|
1339 |
}
|
|
1340 |
}
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
1344 |
{
|
|
1345 |
aMenuPane->DeleteMenuItem( EAknCmdHelp );
|
|
1346 |
}
|
|
1347 |
|
|
1348 |
if( ctrlid != ECalenEditorPeople )
|
|
1349 |
{
|
|
1350 |
aMenuPane->DeleteMenuItem( ECalenCmdAddPeople );
|
|
1351 |
}
|
|
1352 |
}
|
|
1353 |
break;
|
|
1354 |
|
|
1355 |
default:
|
|
1356 |
{
|
|
1357 |
break;
|
|
1358 |
}
|
|
1359 |
}
|
|
1360 |
|
|
1361 |
TRACE_EXIT_POINT;
|
|
1362 |
}
|
|
1363 |
|
|
1364 |
// -----------------------------------------------------------------------------
|
|
1365 |
// CCalenUnifiedEditor::OnCmdCancelL
|
|
1366 |
// Handles cancel command.
|
|
1367 |
// -----------------------------------------------------------------------------
|
|
1368 |
//
|
|
1369 |
void CCalenUnifiedEditor::OnCmdCancelL()
|
|
1370 |
{
|
|
1371 |
TRACE_ENTRY_POINT;
|
|
1372 |
|
|
1373 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
1374 |
if( dlg->ExecuteLD( R_CALEN_CANCEL_CHANGES_QUERY ) )
|
|
1375 |
{
|
|
1376 |
CloseFormWithoutActionsL();
|
|
1377 |
}
|
|
1378 |
|
|
1379 |
TRACE_EXIT_POINT;
|
|
1380 |
}
|
|
1381 |
|
|
1382 |
// -----------------------------------------------------------------------------
|
|
1383 |
// CCalenUnifiedEditor::OnCmdDeleteNoteL
|
|
1384 |
// Handles delete command.
|
|
1385 |
// -----------------------------------------------------------------------------
|
|
1386 |
//
|
|
1387 |
void CCalenUnifiedEditor::OnCmdDeleteNoteL()
|
|
1388 |
{
|
|
1389 |
TRACE_ENTRY_POINT;
|
|
1390 |
|
|
1391 |
TryToDeleteNoteL( ETrue );
|
|
1392 |
|
|
1393 |
TRACE_EXIT_POINT;
|
|
1394 |
}
|
|
1395 |
|
|
1396 |
// -----------------------------------------------------------------------------
|
|
1397 |
// CCalenUnifiedEditor::OnCmdHelpL
|
|
1398 |
// Handles help command.
|
|
1399 |
// -----------------------------------------------------------------------------
|
|
1400 |
//
|
|
1401 |
void CCalenUnifiedEditor::OnCmdHelpL()
|
|
1402 |
{
|
|
1403 |
TRACE_ENTRY_POINT;
|
|
1404 |
|
|
1405 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
1406 |
{
|
|
1407 |
HlpLauncher::LaunchHelpApplicationL(
|
|
1408 |
iCoeEnv->WsSession(),
|
|
1409 |
static_cast<CCoeAppUi*>( iCoeEnv->AppUi() )->AppHelpContextL() );
|
|
1410 |
}
|
|
1411 |
|
|
1412 |
TRACE_EXIT_POINT;
|
|
1413 |
}
|
|
1414 |
|
|
1415 |
// -----------------------------------------------------------------------------
|
|
1416 |
// CCalenUnifiedEditor::OnCmdExitL
|
|
1417 |
// Handles exit command.
|
|
1418 |
// (other items were commented in a header).
|
|
1419 |
// -----------------------------------------------------------------------------
|
|
1420 |
//
|
|
1421 |
void CCalenUnifiedEditor::OnCmdExitL(TInt aCmd)
|
|
1422 |
{
|
|
1423 |
TRACE_ENTRY_POINT;
|
|
1424 |
|
|
1425 |
TryExitL( aCmd );
|
|
1426 |
|
|
1427 |
TRACE_EXIT_POINT;
|
|
1428 |
}
|
|
1429 |
|
|
1430 |
// -----------------------------------------------------------------------------
|
|
1431 |
// CCalenUnifiedEditor::TryToDeleteNoteL
|
|
1432 |
// Deletes the note from agenda.
|
|
1433 |
// (other items were commented in a header).
|
|
1434 |
// -----------------------------------------------------------------------------
|
|
1435 |
//
|
|
1436 |
void CCalenUnifiedEditor::TryToDeleteNoteL( TBool /* aIsViaDeleteMenu */ )
|
|
1437 |
{
|
|
1438 |
TRACE_ENTRY_POINT;
|
|
1439 |
|
|
1440 |
TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems();
|
|
1441 |
if(Edited().AttachmentCount() || attachmentCount)
|
|
1442 |
{
|
|
1443 |
iServices->GetAttachmentData()->Reset();
|
|
1444 |
}
|
|
1445 |
if (IsCreatingNewEntry())
|
|
1446 |
{
|
|
1447 |
iEntryUpdater->TryDeleteInstanceWithUiL( EditorDataHandler().Entry() ,
|
|
1448 |
EditorDataHandler().InstanceDateTime() ,
|
|
1449 |
*iServices );
|
|
1450 |
}
|
|
1451 |
else
|
|
1452 |
{
|
|
1453 |
// FIXME. With new MAgnEntryUi we could use MAgnEntryUi::EInstanceDeleted
|
|
1454 |
iEntryUpdater->TryDeleteInstanceWithUiL( EditorDataHandler().Entry() ,
|
|
1455 |
EditorDataHandler().InstanceDateTime() ,
|
|
1456 |
iRepeatType, *iServices );
|
|
1457 |
}
|
|
1458 |
TRACE_EXIT_POINT;
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
// -----------------------------------------------------------------------------
|
|
1462 |
// CCalenUnifiedEditor::CloseFormWithoutActionsL
|
|
1463 |
// Closes the form. We have to do it via dialog's exit mechanism
|
|
1464 |
// with custom id (KCalenButtonIdCloseForm).
|
|
1465 |
// (other items were commented in a header).
|
|
1466 |
// -----------------------------------------------------------------------------
|
|
1467 |
//
|
|
1468 |
void CCalenUnifiedEditor::CloseFormWithoutActionsL()
|
|
1469 |
{
|
|
1470 |
TRACE_ENTRY_POINT;
|
|
1471 |
|
|
1472 |
TryExitL( KCalenButtonIdCloseForm );
|
|
1473 |
|
|
1474 |
TRACE_EXIT_POINT;
|
|
1475 |
}
|
|
1476 |
|
|
1477 |
// -----------------------------------------------------------------------------
|
|
1478 |
// CCalenUnifiedEditor::CreateCustomControlL
|
|
1479 |
// Returns a new custom control.
|
|
1480 |
// -----------------------------------------------------------------------------
|
|
1481 |
//
|
|
1482 |
SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType )
|
|
1483 |
{
|
|
1484 |
TRACE_ENTRY_POINT;
|
|
1485 |
|
|
1486 |
__ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() );
|
|
1487 |
|
|
1488 |
TRACE_EXIT_POINT;
|
|
1489 |
return iUnifiedEditorControl->Description()->CreateFieldL();
|
|
1490 |
}
|
|
1491 |
|
|
1492 |
// -----------------------------------------------------------------------------
|
|
1493 |
// CCalenUnifiedEditor::ConvertCustomControlTypeToBaseControlType
|
|
1494 |
// This method has to be implemented, otherwise custom components do not work with forms.
|
|
1495 |
// -----------------------------------------------------------------------------
|
|
1496 |
//
|
|
1497 |
MEikDialogPageObserver::TFormControlTypes
|
|
1498 |
CCalenUnifiedEditor::ConvertCustomControlTypeToBaseControlType( TInt aControlType ) const
|
|
1499 |
{
|
|
1500 |
TRACE_ENTRY_POINT;
|
|
1501 |
|
|
1502 |
if( aControlType == ECalenCtDescriptionField )
|
|
1503 |
{
|
|
1504 |
TRACE_EXIT_POINT;
|
|
1505 |
return MEikDialogPageObserver::EEdwinDerived;
|
|
1506 |
}
|
|
1507 |
|
|
1508 |
TRACE_EXIT_POINT;
|
|
1509 |
return MEikDialogPageObserver::EUnknownType;
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
|
|
1513 |
// -----------------------------------------------------------------------------
|
|
1514 |
// CCalenUnifiedEditor::AskRepeatingNoteQueriesL
|
|
1515 |
// (other items were commented in a header).
|
|
1516 |
// -----------------------------------------------------------------------------
|
|
1517 |
//
|
|
1518 |
CCalenEditorDataHandler::TError CCalenUnifiedEditor::AskRepeatingNoteQueriesL(
|
|
1519 |
CalCommon::TRecurrenceRange& aRepeatType )
|
|
1520 |
{
|
|
1521 |
TRACE_ENTRY_POINT
|
|
1522 |
CCalenEditorDataHandler::TError error = CCalenEditorDataHandler::EFormErrNone;
|
|
1523 |
|
|
1524 |
switch( GetEntryType() )
|
|
1525 |
{
|
|
1526 |
case CCalEntry::EAnniv:
|
|
1527 |
{
|
|
1528 |
|
|
1529 |
if ( ShouldQueryForStartDateChange() )
|
|
1530 |
{
|
|
1531 |
// Query for StartDate change
|
|
1532 |
error = QueryStartDateChangeL();
|
|
1533 |
}
|
|
1534 |
|
|
1535 |
TRACE_EXIT_POINT;
|
|
1536 |
return error;
|
|
1537 |
}
|
|
1538 |
//break;
|
|
1539 |
|
|
1540 |
case CCalEntry::EAppt:
|
|
1541 |
{
|
|
1542 |
if ( ShouldQueryForStartDateChange() )
|
|
1543 |
{
|
|
1544 |
if ( EditorDataHandler().IsStartDateChanged() )
|
|
1545 |
{
|
|
1546 |
TRACE_EXIT_POINT;
|
|
1547 |
|
|
1548 |
// Query for StartDate change
|
|
1549 |
return QueryStartDateChangeL();
|
|
1550 |
}
|
|
1551 |
}
|
|
1552 |
|
|
1553 |
if( iHasChosenRepeatType )
|
|
1554 |
{
|
|
1555 |
// Don't ask the "this/series" question when we have chosen already.
|
|
1556 |
return error;
|
|
1557 |
}
|
|
1558 |
TRACE_EXIT_POINT;
|
|
1559 |
return iUnifiedEditorControl->AskRepeatingNoteQueriesL(aRepeatType);
|
|
1560 |
}
|
|
1561 |
//break;
|
|
1562 |
|
|
1563 |
case CCalEntry::ETodo:
|
|
1564 |
case CCalEntry::EEvent:
|
|
1565 |
{
|
|
1566 |
TRACE_EXIT_POINT;
|
|
1567 |
return error;
|
|
1568 |
}
|
|
1569 |
//break;
|
|
1570 |
|
|
1571 |
default:
|
|
1572 |
break;
|
|
1573 |
}
|
|
1574 |
return error;
|
|
1575 |
}
|
|
1576 |
|
|
1577 |
|
|
1578 |
|
|
1579 |
TBool CCalenUnifiedEditor::ShouldQueryForStartDateChange()
|
|
1580 |
{
|
|
1581 |
TBool shouldQuery = EFalse;
|
|
1582 |
// For Meeting entry type.
|
|
1583 |
if( GetEntryType() == CCalEntry::EAppt )
|
|
1584 |
{
|
|
1585 |
TRACE_EXIT_POINT;
|
|
1586 |
shouldQuery = ! IsCreatingNewEntry() &&
|
|
1587 |
( Edited().IsRepeating() && EditorDataHandler().Original().IsRepeating() );
|
|
1588 |
}
|
|
1589 |
|
|
1590 |
// For Anniversary enty type
|
|
1591 |
if( GetEntryType() == CCalEntry::EAnniv )
|
|
1592 |
{
|
|
1593 |
TRACE_EXIT_POINT;
|
|
1594 |
shouldQuery = ! IsCreatingNewEntry();
|
|
1595 |
}
|
|
1596 |
return shouldQuery;
|
|
1597 |
TRACE_EXIT_POINT;
|
|
1598 |
}
|
|
1599 |
|
|
1600 |
// -----------------------------------------------------------------------------
|
|
1601 |
// CCalenUnifiedEditor::QueryStartDateChangeL
|
|
1602 |
// If the entry is repeating, and the edited start date is different from the
|
|
1603 |
// original start date, prompt the user and ask if they are sure they want to
|
|
1604 |
// change the start date of the repeating entry.
|
|
1605 |
// (other items were commented in a header).
|
|
1606 |
// -----------------------------------------------------------------------------
|
|
1607 |
//
|
|
1608 |
CCalenEditorDataHandler::TError CCalenUnifiedEditor::QueryStartDateChangeL()
|
|
1609 |
{
|
|
1610 |
TRACE_ENTRY_POINT;
|
|
1611 |
TTime oldStartDate = EditorDataHandler().Original().StartDateTime();
|
|
1612 |
TTime newStartDate = Edited().StartDateTime();
|
|
1613 |
|
|
1614 |
// The "Are you sure you want to change start date of repeating note?"
|
|
1615 |
// query should only be shown for repeating notes.
|
|
1616 |
if ( iRepeatType == CalCommon::EThisAndAll
|
|
1617 |
&& ! CalenDateUtils::OnSameDay( oldStartDate, newStartDate ) )
|
|
1618 |
{
|
|
1619 |
CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
|
|
1620 |
TInt answer = queryDlg->ExecuteLD( R_CALEN_REPEAT_NOTE_START_CHANGED );
|
|
1621 |
if (!answer) // Answer "No"
|
|
1622 |
{
|
|
1623 |
TRACE_EXIT_POINT;
|
|
1624 |
return CCalenEditorDataHandler::EFormErrCancelSaveRepNoteWhenStartChange;
|
|
1625 |
}
|
|
1626 |
}
|
|
1627 |
TRACE_EXIT_POINT;
|
|
1628 |
return CCalenEditorDataHandler::EFormErrNone;
|
|
1629 |
}
|
|
1630 |
// -----------------------------------------------------------------------------
|
|
1631 |
// CCalenUnifiedEditor::IsCreatingNewEntry
|
|
1632 |
// Returns ETrue if the entry has just been created, EFalse if the entry
|
|
1633 |
// already existed in agenda.
|
|
1634 |
// -----------------------------------------------------------------------------
|
|
1635 |
//
|
|
1636 |
TBool CCalenUnifiedEditor::IsCreatingNewEntry() const
|
|
1637 |
{
|
|
1638 |
TRACE_ENTRY_POINT;
|
|
1639 |
|
|
1640 |
TRACE_EXIT_POINT;
|
|
1641 |
return iEntryUiInParams.iEditorMode == MAgnEntryUi::ECreateNewEntry;
|
|
1642 |
}
|
|
1643 |
|
|
1644 |
// -----------------------------------------------------------------------------
|
|
1645 |
// CCalenUnifiedEditor::MaxTextEditorLength
|
|
1646 |
// Returns the maximum length the text editor can be.
|
|
1647 |
// -----------------------------------------------------------------------------
|
|
1648 |
//
|
|
1649 |
TInt CCalenUnifiedEditor::MaxTextEditorLength() const
|
|
1650 |
{
|
|
1651 |
TRACE_ENTRY_POINT;
|
|
1652 |
|
|
1653 |
switch ( AknLayoutUtils::Variant() )
|
|
1654 |
{
|
|
1655 |
case EEuropeanVariant:
|
|
1656 |
{
|
|
1657 |
TRACE_EXIT_POINT;
|
|
1658 |
return KCalenMaxELAFTextEditorLength;
|
|
1659 |
}
|
|
1660 |
case EApacVariant:
|
|
1661 |
{
|
|
1662 |
TRACE_EXIT_POINT;
|
|
1663 |
return KCalenMaxAPACTextEditorLength;
|
|
1664 |
}
|
|
1665 |
}
|
|
1666 |
|
|
1667 |
TRACE_EXIT_POINT;
|
|
1668 |
return 0;
|
|
1669 |
}
|
|
1670 |
|
|
1671 |
// -----------------------------------------------------------------------------
|
|
1672 |
// CCalenUnifiedEditor::EditorDataHandler
|
|
1673 |
// Returns the editor data handler.
|
|
1674 |
// -----------------------------------------------------------------------------
|
|
1675 |
//
|
|
1676 |
CCalenEditorDataHandler& CCalenUnifiedEditor::EditorDataHandler()
|
|
1677 |
{
|
|
1678 |
TRACE_ENTRY_POINT;
|
|
1679 |
|
|
1680 |
TRACE_EXIT_POINT;
|
|
1681 |
return *iEditorDataHandler;
|
|
1682 |
}
|
|
1683 |
|
|
1684 |
// -----------------------------------------------------------------------------
|
|
1685 |
// CCalenUnifiedEditor::Edited
|
|
1686 |
// Returns the data being edited.
|
|
1687 |
// -----------------------------------------------------------------------------
|
|
1688 |
//
|
|
1689 |
CCalenEntryUtil& CCalenUnifiedEditor::Edited()
|
|
1690 |
{
|
|
1691 |
TRACE_ENTRY_POINT;
|
|
1692 |
|
|
1693 |
TRACE_EXIT_POINT;
|
|
1694 |
return iEditorDataHandler->Edited();
|
|
1695 |
}
|
|
1696 |
|
|
1697 |
// -----------------------------------------------------------------------------
|
|
1698 |
// CCalenUnifiedEditor::Original
|
|
1699 |
// Returns the original data.
|
|
1700 |
// -----------------------------------------------------------------------------
|
|
1701 |
//
|
|
1702 |
const CCalenEntryUtil& CCalenUnifiedEditor::Original() const
|
|
1703 |
{
|
|
1704 |
TRACE_ENTRY_POINT;
|
|
1705 |
|
|
1706 |
TRACE_EXIT_POINT;
|
|
1707 |
return iEditorDataHandler->Original();
|
|
1708 |
}
|
|
1709 |
|
|
1710 |
// -----------------------------------------------------------------------------
|
|
1711 |
// CCalenUnifiedEditor::SetEditorTextL
|
|
1712 |
// Sets editor text
|
|
1713 |
// -----------------------------------------------------------------------------
|
|
1714 |
//
|
|
1715 |
void CCalenUnifiedEditor::SetEditorTextL( TInt aControlId, const TDesC* aDes )
|
|
1716 |
{
|
|
1717 |
TRACE_ENTRY_POINT;
|
|
1718 |
|
|
1719 |
SetEdwinTextL( aControlId, aDes );
|
|
1720 |
|
|
1721 |
TRACE_EXIT_POINT;
|
|
1722 |
}
|
|
1723 |
|
|
1724 |
// -----------------------------------------------------------------------------
|
|
1725 |
// CCalenUnifiedEditor::ReadSubjectFromEditorL
|
|
1726 |
// Reads subject field from unified editor
|
|
1727 |
// -----------------------------------------------------------------------------
|
|
1728 |
//
|
|
1729 |
void CCalenUnifiedEditor::ReadSubjectFromEditorL()
|
|
1730 |
{
|
|
1731 |
TRACE_ENTRY_POINT;
|
|
1732 |
|
|
1733 |
TBuf<ECalenAbsoluteMaxTextEditorLength> editorText;
|
|
1734 |
GetEdwinText( editorText,ECalenEditorSubject );
|
|
1735 |
Edited().SetSummaryL( editorText );
|
|
1736 |
|
|
1737 |
TRACE_EXIT_POINT;
|
|
1738 |
}
|
|
1739 |
|
|
1740 |
// -----------------------------------------------------------------------------
|
|
1741 |
// CCalenUnifiedEditor::ReadPlaceFromEditorL
|
|
1742 |
// Reads "Place" item from unified editor
|
|
1743 |
// -----------------------------------------------------------------------------
|
|
1744 |
//
|
|
1745 |
void CCalenUnifiedEditor::ReadPlaceFromEditorL()
|
|
1746 |
{
|
|
1747 |
TRACE_ENTRY_POINT;
|
|
1748 |
|
|
1749 |
// Location
|
|
1750 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
1751 |
GetEdwinText(location, ECalenEditorPlace);
|
|
1752 |
|
|
1753 |
TInt pos = location.Locate(TChar(CEditableText::EPictureCharacter));
|
|
1754 |
while(pos != KErrNotFound)
|
|
1755 |
{
|
|
1756 |
location.Delete(pos, 1);
|
|
1757 |
pos = location.Locate(TChar(CEditableText::EPictureCharacter));
|
|
1758 |
}
|
|
1759 |
|
|
1760 |
Edited().SetLocationL( location );
|
|
1761 |
SetEdwinTextL( ECalenEditorPlace, &location );
|
|
1762 |
|
|
1763 |
TRACE_EXIT_POINT;
|
|
1764 |
}
|
|
1765 |
|
|
1766 |
// -----------------------------------------------------------------------------
|
|
1767 |
// CCalenUnifiedEditor::SetEntryType
|
|
1768 |
// Sets the unified editor's entry type
|
|
1769 |
// -----------------------------------------------------------------------------
|
|
1770 |
//
|
|
1771 |
void CCalenUnifiedEditor::SetEntryType( CCalEntry::TType aEntryType )
|
|
1772 |
{
|
|
1773 |
TRACE_ENTRY_POINT;
|
|
1774 |
iEntryType = aEntryType;
|
|
1775 |
TRACE_EXIT_POINT;
|
|
1776 |
}
|
|
1777 |
|
|
1778 |
// -----------------------------------------------------------------------------
|
|
1779 |
// CCalenUnifiedEditor::GetEntryType
|
|
1780 |
// Gets unified editor entry type
|
|
1781 |
// -----------------------------------------------------------------------------
|
|
1782 |
//
|
|
1783 |
CCalEntry::TType CCalenUnifiedEditor::GetEntryType()
|
|
1784 |
{
|
|
1785 |
TRACE_ENTRY_POINT;
|
|
1786 |
TRACE_EXIT_POINT;
|
|
1787 |
return iEntryType;
|
|
1788 |
}
|
|
1789 |
|
|
1790 |
|
|
1791 |
// -----------------------------------------------------------------------------
|
|
1792 |
// CCalenUnifiedEditor::EditorFields
|
|
1793 |
// Access to the unified editor's fields
|
|
1794 |
// -----------------------------------------------------------------------------
|
|
1795 |
//
|
|
1796 |
CCalenUnifiedEditorControl& CCalenUnifiedEditor::EditorFields()
|
|
1797 |
{
|
|
1798 |
TRACE_ENTRY_POINT;
|
|
1799 |
TRACE_EXIT_POINT;
|
|
1800 |
return *iUnifiedEditorControl;
|
|
1801 |
}
|
|
1802 |
|
|
1803 |
// -----------------------------------------------------------------------------
|
|
1804 |
// CCalenUnifiedEditor::SetAlarmFieldOnOffL
|
|
1805 |
// Set alarm field on or off
|
|
1806 |
// -----------------------------------------------------------------------------
|
|
1807 |
//
|
|
1808 |
void CCalenUnifiedEditor::SetAlarmFieldOnOffL( TBool aOnOff )
|
|
1809 |
{
|
|
1810 |
TRACE_ENTRY_POINT;
|
|
1811 |
|
|
1812 |
HBufC* String;
|
|
1813 |
CEikEdwin* alarmFieldText =( CEikEdwin* )Control( ECalenEditorReminder );
|
|
1814 |
if( aOnOff )
|
|
1815 |
{
|
|
1816 |
// load string 'ON'
|
|
1817 |
String = StringLoader::LoadLC( R_QTN_ALARM_ACTIVE, iCoeEnv );
|
|
1818 |
}
|
|
1819 |
else
|
|
1820 |
{
|
|
1821 |
// load string 'OFF'
|
|
1822 |
String = StringLoader::LoadLC( R_QTN_ALARM_OFF,iCoeEnv );
|
|
1823 |
}
|
|
1824 |
// set Alarm field string as 'ON'/'OFF'
|
|
1825 |
alarmFieldText->SetTextL(String);
|
|
1826 |
CleanupStack::PopAndDestroy(String);
|
|
1827 |
|
|
1828 |
TRACE_EXIT_POINT;
|
|
1829 |
}
|
|
1830 |
|
|
1831 |
// -----------------------------------------------------------------------------
|
|
1832 |
// CCalenUnifiedEditor::SetAllDayFieldL
|
|
1833 |
// Set alarm field on or off
|
|
1834 |
// -----------------------------------------------------------------------------
|
|
1835 |
//
|
|
1836 |
void CCalenUnifiedEditor::SetAllDayFieldL(TBool aYesNo)
|
|
1837 |
{
|
|
1838 |
TRACE_ENTRY_POINT;
|
|
1839 |
|
|
1840 |
HBufC* String;
|
|
1841 |
CEikEdwin* allDayFieldText =( CEikEdwin* )ControlOrNull( ECalenEditorAllDayItem );
|
|
1842 |
if( aYesNo )
|
|
1843 |
{
|
|
1844 |
// load string 'YES'
|
|
1845 |
String = StringLoader::LoadLC( R_QTN_ALLDAY_EVENT_YES,iCoeEnv );
|
|
1846 |
}
|
|
1847 |
else
|
|
1848 |
{
|
|
1849 |
// load string 'NO'
|
|
1850 |
String = StringLoader::LoadLC( R_QTN_ALLDAY_EVENT_NO,iCoeEnv );
|
|
1851 |
}
|
|
1852 |
if( allDayFieldText )
|
|
1853 |
{
|
|
1854 |
// Set AllDay field text as 'YES'/'NO'
|
|
1855 |
allDayFieldText->SetTextL( String );
|
|
1856 |
}
|
|
1857 |
CleanupStack::PopAndDestroy( String );
|
|
1858 |
|
|
1859 |
TRACE_EXIT_POINT;
|
|
1860 |
}
|
|
1861 |
|
|
1862 |
// -----------------------------------------------------------------------------
|
|
1863 |
// CCalenUnifiedEditor::IdOfFocusedControl
|
|
1864 |
// For getting Id of the focused control
|
|
1865 |
// -----------------------------------------------------------------------------
|
|
1866 |
//
|
|
1867 |
TInt CCalenUnifiedEditor::IdOfFocusedControl()
|
|
1868 |
{
|
|
1869 |
TRACE_ENTRY_POINT;
|
|
1870 |
TRACE_EXIT_POINT;
|
|
1871 |
return IdOfFocusControl();
|
|
1872 |
}
|
|
1873 |
|
|
1874 |
// -----------------------------------------------------------------------------
|
|
1875 |
// CCalenUnifiedEditor::HandleDoneL
|
|
1876 |
// Handle pressing of Done (LSK). Entry is saved or deleted, or if not edited
|
|
1877 |
// nothing is done.
|
|
1878 |
// -----------------------------------------------------------------------------
|
|
1879 |
//
|
|
1880 |
TBool CCalenUnifiedEditor::HandleDoneL()
|
|
1881 |
{
|
|
1882 |
TRACE_ENTRY_POINT;
|
|
1883 |
|
|
1884 |
const TBool continueOnError = EFalse;
|
|
1885 |
iUnifiedEditorControl->ReadDataFromEditorL( continueOnError );
|
|
1886 |
|
|
1887 |
TEntryExistenceStatus status;
|
|
1888 |
|
|
1889 |
if(!IsCreatingNewEntry())
|
|
1890 |
{
|
|
1891 |
status = EntryStillExistsL();
|
|
1892 |
}
|
|
1893 |
else
|
|
1894 |
{
|
|
1895 |
status = EEntryOk;
|
|
1896 |
}
|
|
1897 |
|
|
1898 |
TTimeIntervalDays aDay(0);
|
|
1899 |
if( iCurrentDurationDay<aDay )
|
|
1900 |
{
|
|
1901 |
DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrStopTimeEarlierThanStartTime );
|
|
1902 |
return EFalse;
|
|
1903 |
}
|
|
1904 |
|
|
1905 |
if ( status == EEntryOk )
|
|
1906 |
{
|
|
1907 |
|
|
1908 |
TTime startDate = Edited().StartDateTime();
|
|
1909 |
TTime endDate = Edited().EndDateTime();
|
|
1910 |
TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
|
|
1911 |
|
|
1912 |
if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
|
|
1913 |
endDate == CalenDateUtils::BeginningOfDay( endDate ) )
|
|
1914 |
{
|
|
1915 |
if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() >= 1 )
|
|
1916 |
{
|
|
1917 |
Edited().SetEntryType( CCalEntry::EEvent );
|
|
1918 |
}
|
|
1919 |
}
|
|
1920 |
if(differenceInTime.Int() == 0 && (CCalEntry::EAppt == Edited().EntryType() || CCalEntry::EEvent == Edited().EntryType()))
|
|
1921 |
{
|
|
1922 |
Edited().SetEntryType( CCalEntry::EAppt ); //changed
|
|
1923 |
}
|
|
1924 |
|
|
1925 |
switch ( EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL() )
|
|
1926 |
{
|
|
1927 |
case CCalenEditorDataHandler::EActionSave:
|
|
1928 |
{
|
|
1929 |
TRACE_EXIT_POINT;
|
|
1930 |
return TryToSaveNoteL();
|
|
1931 |
}
|
|
1932 |
case CCalenEditorDataHandler::EActionDelete:
|
|
1933 |
{
|
|
1934 |
TryToDeleteNoteL( EFalse );
|
|
1935 |
TRACE_EXIT_POINT;
|
|
1936 |
// don't exit from the editor dialog here
|
|
1937 |
// wait for the delete success/ delete failed notification
|
|
1938 |
// exit from CCalenFormBase::HandleNotification( aNotification );
|
|
1939 |
// return ETrue;
|
|
1940 |
return EFalse;
|
|
1941 |
}
|
|
1942 |
case CCalenEditorDataHandler::EActionNothing:
|
|
1943 |
{
|
|
1944 |
TRACE_EXIT_POINT;
|
|
1945 |
return ETrue;
|
|
1946 |
}
|
|
1947 |
}
|
|
1948 |
}
|
|
1949 |
else
|
|
1950 |
{
|
|
1951 |
if( status == EEntryModifiedByAnotherProcess )
|
|
1952 |
{
|
|
1953 |
// Entry no longer exists. Show an error message then return to the viewer.
|
|
1954 |
DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrDbConflictEntryModified );
|
|
1955 |
// Other process may have changed start day/time.
|
|
1956 |
|
|
1957 |
// FIXME
|
|
1958 |
// Assumes the entry view is not null
|
|
1959 |
CCalEntry *newEntry = NULL;
|
|
1960 |
for(TInt i = 0 ; i < iCollectionIds.Count() ; i++)
|
|
1961 |
{
|
|
1962 |
newEntry = ( *( iServices->EntryViewL(iCollectionIds[i]) ) )
|
|
1963 |
.FetchL( iOriginalCalEntry->LocalUidL() );
|
|
1964 |
}
|
|
1965 |
|
|
1966 |
if(newEntry)
|
|
1967 |
{
|
|
1968 |
CleanupStack::PushL( newEntry );
|
|
1969 |
iEntryUiOutParams.iNewInstanceDate = newEntry->StartTimeL();
|
|
1970 |
iEntryUiOutParams.iSpare = (TUint32) newEntry->LocalUidL();
|
|
1971 |
CleanupStack::PopAndDestroy(newEntry);
|
|
1972 |
iEntryUiOutParams.iAction = EMeetingSaved;
|
|
1973 |
}
|
|
1974 |
}
|
|
1975 |
else
|
|
1976 |
{
|
|
1977 |
if( status == EEntryDeletedByAnotherProcess )
|
|
1978 |
{
|
|
1979 |
// Entry no longer exists. Show an error message then close the form.
|
|
1980 |
DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrDbConflictEntryDeleted );
|
|
1981 |
iEntryUiOutParams.iAction = EMeetingDeleted;
|
|
1982 |
}
|
|
1983 |
}
|
|
1984 |
|
|
1985 |
TRACE_EXIT_POINT;
|
|
1986 |
return ETrue;
|
|
1987 |
}
|
|
1988 |
|
|
1989 |
// All cases should be handled above
|
|
1990 |
__ASSERT_ALWAYS( EFalse, User::Invariant() );
|
|
1991 |
TRACE_EXIT_POINT;
|
|
1992 |
return EFalse;
|
|
1993 |
}
|
|
1994 |
|
|
1995 |
// -----------------------------------------------------------------------------
|
|
1996 |
// CheckSpaceBelowCriticalLevelL
|
|
1997 |
// Checks if the Flash File System storage will fall below critical level.
|
|
1998 |
// If there is not enough space, display an error message and return EFalse.
|
|
1999 |
// Return ETrue otherwise.
|
|
2000 |
// (other items were commented in a header).
|
|
2001 |
// -----------------------------------------------------------------------------
|
|
2002 |
//
|
|
2003 |
TBool CCalenUnifiedEditor::CheckSpaceBelowCriticalLevelL()
|
|
2004 |
{
|
|
2005 |
TRACE_ENTRY_POINT;
|
|
2006 |
// FIXME: Could be moved to commonui
|
|
2007 |
TBool retcode(EFalse);
|
|
2008 |
|
|
2009 |
if ( SysUtil::FFSSpaceBelowCriticalLevelL( &( iCoeEnv->FsSession() ) ) )
|
|
2010 |
{
|
|
2011 |
CErrorUI* errorUi = CErrorUI::NewLC();
|
|
2012 |
errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
|
|
2013 |
CleanupStack::PopAndDestroy( errorUi );
|
|
2014 |
retcode = ETrue;
|
|
2015 |
}
|
|
2016 |
TRACE_EXIT_POINT;
|
|
2017 |
return retcode;
|
|
2018 |
}
|
|
2019 |
|
|
2020 |
// -----------------------------------------------------------------------------
|
|
2021 |
// CCalenUnifiedEditor::TryToSaveNoteL
|
|
2022 |
// Save form data. Return ETrue if saving is successful, EFalse otherwise.
|
|
2023 |
// (other items were commented in a header).
|
|
2024 |
// -----------------------------------------------------------------------------
|
|
2025 |
//
|
|
2026 |
TBool CCalenUnifiedEditor::TryToSaveNoteL()
|
|
2027 |
{
|
|
2028 |
TRACE_ENTRY_POINT;
|
|
2029 |
|
|
2030 |
if( CheckSpaceBelowCriticalLevelL() )
|
|
2031 |
{
|
|
2032 |
TRACE_EXIT_POINT;
|
|
2033 |
return EFalse;
|
|
2034 |
}
|
|
2035 |
|
|
2036 |
// Check if location field is edited manually
|
|
2037 |
CheckManualEditionOfLocationL();
|
|
2038 |
|
|
2039 |
|
|
2040 |
CCalenEditorDataHandler::TError error = CCalenEditorDataHandler::EFormErrNone;
|
|
2041 |
|
|
2042 |
if( ( !iHasChosenRepeatType && ! EditorDataHandler().IsChildL() ) ||
|
|
2043 |
(iHasChosenRepeatType && iRepeatType == CalCommon::EThisAndAll ) )
|
|
2044 |
{
|
|
2045 |
// Check for the errors, with the entered data
|
|
2046 |
error = EditorDataHandler().CheckErrorsForThisAndAllL();
|
|
2047 |
}
|
|
2048 |
else if( EditorDataHandler().IsChildL() || iRepeatType == CalCommon::EThisOnly )
|
|
2049 |
{
|
|
2050 |
// Check for the errors, for editing Child entry.
|
|
2051 |
error = EditorDataHandler().CheckErrorsForThisOnlyL( ParentEntryL(), *(iServices->InstanceViewL(iCollectionIds) ));
|
|
2052 |
}
|
|
2053 |
|
|
2054 |
if ( error == CCalenEditorDataHandler::EFormErrNone )
|
|
2055 |
{
|
|
2056 |
error = AskRepeatingNoteQueriesL(iRepeatType);
|
|
2057 |
if(error == CCalenEditorDataHandler::EFormErrNone)
|
|
2058 |
{
|
|
2059 |
iHasChosenRepeatType = ETrue;
|
|
2060 |
}
|
|
2061 |
}
|
|
2062 |
|
|
2063 |
if ( error == CCalenEditorDataHandler::EFormErrNone )
|
|
2064 |
{
|
|
2065 |
ModifyDbFieldL();//default calendar code
|
|
2066 |
EditorDataHandler().WriteChangesToEntryL( iRepeatType );
|
|
2067 |
|
|
2068 |
TCalTime newInstanceStartDate, newInstanceEndDate;
|
|
2069 |
CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, newInstanceEndDate );
|
|
2070 |
if(EditorDataHandler().IsRepeatRuleEdited() && !IsCreatingNewEntry())
|
|
2071 |
{
|
|
2072 |
MCalenContext& context = iServices->Context();
|
|
2073 |
TCalenInstanceId instanceId = context.InstanceId();
|
|
2074 |
context.SetFocusDateAndTimeL(newInstanceStartDate,TVwsViewId( KUidCalendar, KUidCalenEventView));
|
|
2075 |
}
|
|
2076 |
|
|
2077 |
TInt saveErr( 0 );
|
|
2078 |
TBool dbChange = iEditorDataHandler->IsCalendarEditedL();
|
|
2079 |
if( iEditedCalEntry.EntryTypeL() != Edited().EntryType() || dbChange )
|
|
2080 |
{
|
|
2081 |
// If calendar EntryType is changed,
|
|
2082 |
// Entry should be re-created with new EntryType and Save.
|
|
2083 |
saveErr = TryToSaveEntryWithEntryChangeL( EFalse );
|
|
2084 |
}
|
|
2085 |
else
|
|
2086 |
{
|
|
2087 |
TRAP( saveErr, iEntryUpdater->UpdateInstanceL(
|
|
2088 |
EditorDataHandler().Entry(),
|
|
2089 |
*iOriginalCalEntry,
|
|
2090 |
EditorDataHandler().InstanceDateTime(),
|
|
2091 |
iRepeatType,
|
|
2092 |
newInstanceStartDate,
|
|
2093 |
newInstanceEndDate,
|
|
2094 |
iUnifiedEditorControl->GetCalendarNameForEntryL() ) );
|
|
2095 |
|
|
2096 |
iEntryUiOutParams.iSpare
|
|
2097 |
= (TUint32) EditorDataHandler().Entry().LocalUidL();
|
|
2098 |
}
|
|
2099 |
|
|
2100 |
if ( saveErr != KErrNone )
|
|
2101 |
{
|
|
2102 |
iEikonEnv->ResolveError( saveErr );
|
|
2103 |
}
|
|
2104 |
else
|
|
2105 |
{
|
|
2106 |
iEntryUiOutParams.iAction = MAgnEntryUi::EMeetingSaved;
|
|
2107 |
iEntryUiOutParams.iNewInstanceDate = newInstanceStartDate;
|
|
2108 |
}
|
|
2109 |
TRACE_EXIT_POINT;
|
|
2110 |
return ETrue;
|
|
2111 |
}
|
|
2112 |
|
|
2113 |
else
|
|
2114 |
{
|
|
2115 |
// If save error occurs, display error message.
|
|
2116 |
DisplayErrorMsgL( error );
|
|
2117 |
iUnifiedEditorControl->HandleErrorL(error);
|
|
2118 |
TRACE_EXIT_POINT;
|
|
2119 |
return EFalse;
|
|
2120 |
}
|
|
2121 |
}
|
|
2122 |
|
|
2123 |
// -----------------------------------------------------------------------------
|
|
2124 |
// CCalenUnifiedEditor::TryToSaveEntryWithEntryTypeChangeL
|
|
2125 |
// Save form data. Return EErrNone if saving is successful, error value otherwise.
|
|
2126 |
// (other items were commented in a header).
|
|
2127 |
// -----------------------------------------------------------------------------
|
|
2128 |
//
|
|
2129 |
|
|
2130 |
TInt CCalenUnifiedEditor::TryToSaveEntryWithEntryChangeL( TBool aForcedExit)
|
|
2131 |
{
|
|
2132 |
CCalEntry* entry;
|
|
2133 |
|
|
2134 |
//Get the guid from original entry and set it to new entry.
|
|
2135 |
HBufC8* guid = iOriginalCalEntry->UidL().AllocL();
|
|
2136 |
|
|
2137 |
|
|
2138 |
if( iEditedCalEntry.RecurrenceIdL().TimeUtcL() != Time::NullTTime() )
|
|
2139 |
{
|
|
2140 |
entry = CCalEntry::NewL( Edited().EntryType(),
|
|
2141 |
guid,
|
|
2142 |
iEditedCalEntry.MethodL(),
|
|
2143 |
iEditedCalEntry.SequenceNumberL(),
|
|
2144 |
iEditedCalEntry.RecurrenceIdL(),
|
|
2145 |
iEditedCalEntry.RecurrenceRangeL() );
|
|
2146 |
|
|
2147 |
}
|
|
2148 |
else
|
|
2149 |
{
|
|
2150 |
entry = CCalEntry::NewL( Edited().EntryType(),
|
|
2151 |
guid,
|
|
2152 |
iEditedCalEntry.MethodL(),
|
|
2153 |
iEditedCalEntry.SequenceNumberL() );
|
|
2154 |
|
|
2155 |
}
|
|
2156 |
|
|
2157 |
// CleanupStack::Pop( guid ); // ownership was passed
|
|
2158 |
|
|
2159 |
CleanupStack::PushL( entry );
|
|
2160 |
iEditedCalEntry.DescriptionL(); // make sure entry is fully loaded
|
|
2161 |
if (CCalEntry::ETodo == entry->EntryTypeL())//check the entry type
|
|
2162 |
{//remove GeoValue and Location info from a ToDo as ToDo does specs
|
|
2163 |
//does not include them
|
|
2164 |
iEditedCalEntry.ClearGeoValueL();
|
|
2165 |
iEditedCalEntry.SetLocationL(KNullDesC);
|
|
2166 |
}
|
|
2167 |
|
|
2168 |
entry->CopyFromL(iEditedCalEntry, CCalEntry::EDontCopyId);
|
|
2169 |
entry->DescriptionL(); // make sure entry is fully copied
|
|
2170 |
|
|
2171 |
TCalTime newInstanceStartDate, newInstanceEndDate;
|
|
2172 |
CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, newInstanceEndDate );
|
|
2173 |
entry->SetStartAndEndTimeL( newInstanceStartDate, newInstanceEndDate );
|
|
2174 |
if(iEditedCalEntry.EntryTypeL() != GetEntryType())
|
|
2175 |
{
|
|
2176 |
if( entry->EntryTypeL() == CCalEntry::EAnniv )
|
|
2177 |
{
|
|
2178 |
// Set yearly rule to Anniversary entry, to create Annaiversary instance yearly
|
|
2179 |
TCalRRule rrule( TCalRRule::EYearly );
|
|
2180 |
TCalTime startDate;
|
|
2181 |
rrule.SetDtStart( newInstanceStartDate );
|
|
2182 |
rrule.SetInterval( 1 ); // once a year
|
|
2183 |
entry->SetRRuleL( rrule );
|
|
2184 |
}
|
|
2185 |
}
|
|
2186 |
|
|
2187 |
|
|
2188 |
|
|
2189 |
TInt saveErr( KErrNone );
|
|
2190 |
if( aForcedExit )
|
|
2191 |
{
|
|
2192 |
iEntryUpdater->UpdateInstanceL(
|
|
2193 |
*entry,
|
|
2194 |
*iOriginalCalEntry,
|
|
2195 |
EditorDataHandler().InstanceDateTime(),
|
|
2196 |
iRepeatType,
|
|
2197 |
newInstanceStartDate,
|
|
2198 |
newInstanceEndDate,
|
|
2199 |
iUnifiedEditorControl->GetCalendarNameForEntryL() );
|
|
2200 |
|
|
2201 |
}
|
|
2202 |
else
|
|
2203 |
{
|
|
2204 |
TRAP( saveErr, iEntryUpdater->UpdateInstanceL(
|
|
2205 |
*entry,
|
|
2206 |
*iOriginalCalEntry,
|
|
2207 |
EditorDataHandler().InstanceDateTime(),
|
|
2208 |
iRepeatType,
|
|
2209 |
newInstanceStartDate,
|
|
2210 |
newInstanceEndDate,
|
|
2211 |
iUnifiedEditorControl->GetCalendarNameForEntryL() ) );
|
|
2212 |
}
|
|
2213 |
|
|
2214 |
//Agenda server is taking care of deleting the old entry when only entrytype is changing
|
|
2215 |
//so calendar is not deleting the old entry here, when only entry type has changed.
|
|
2216 |
if(!IsCreatingNewEntry() && iEditorDataHandler->IsCalendarEditedL())
|
|
2217 |
{
|
|
2218 |
iServices->GetAttachmentData()->Reset();
|
|
2219 |
iServices->EntryViewL(iEditorDataHandler->PreviousDbCollectionId())
|
|
2220 |
->DeleteL(*iOriginalCalEntry);
|
|
2221 |
}
|
|
2222 |
iEntryUiOutParams.iSpare = (TUint32) entry->LocalUidL();
|
|
2223 |
|
|
2224 |
CleanupStack::PopAndDestroy(entry);
|
|
2225 |
return saveErr;
|
|
2226 |
|
|
2227 |
}
|
|
2228 |
|
|
2229 |
// -----------------------------------------------------------------------------
|
|
2230 |
// CCalenUnifiedEditor::TryToSaveNoteOnForcedExitL
|
|
2231 |
// Try to save note when editors are forced to exit.
|
|
2232 |
// This can happen when the user presses the red key, power off, Options->Exit,
|
|
2233 |
// or in out-of-memory situations.
|
|
2234 |
// (other items were commented in a header).
|
|
2235 |
// -----------------------------------------------------------------------------
|
|
2236 |
//
|
|
2237 |
void CCalenUnifiedEditor::TryToSaveNoteOnForcedExitL()
|
|
2238 |
{
|
|
2239 |
TRACE_ENTRY_POINT;
|
|
2240 |
iCheck = ETrue;
|
|
2241 |
if( EntryStillExistsL() == EEntryOk )
|
|
2242 |
{
|
|
2243 |
if( CheckSpaceBelowCriticalLevelL() )
|
|
2244 |
{
|
|
2245 |
TRACE_EXIT_POINT;
|
|
2246 |
return;
|
|
2247 |
}
|
|
2248 |
|
|
2249 |
// Check if location field is edited manually
|
|
2250 |
CheckManualEditionOfLocationL();
|
|
2251 |
|
|
2252 |
const TBool continueOnError = ETrue;
|
|
2253 |
iUnifiedEditorControl->ReadDataFromEditorL( continueOnError );
|
|
2254 |
|
|
2255 |
CCalenEditorDataHandler::TAction action =
|
|
2256 |
EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL();
|
|
2257 |
if( iHasChosenRepeatType && iRepeatType == CalCommon::EThisAndAll )
|
|
2258 |
{
|
|
2259 |
// Check for the errors, with the entered data
|
|
2260 |
if ( EditorDataHandler().CheckErrorsForThisAndAllL() != KErrNone )
|
|
2261 |
return;
|
|
2262 |
}
|
|
2263 |
if ( action == CCalenEditorDataHandler::EActionSave )
|
|
2264 |
{
|
|
2265 |
EditorDataHandler().ForceValidValuesL( iHasChosenRepeatType? iRepeatType
|
|
2266 |
: CalCommon::EThisAndAll );
|
|
2267 |
ModifyDbFieldL();//Default Calendar code
|
|
2268 |
EditorDataHandler().WriteChangesToEntryL( iHasChosenRepeatType? iRepeatType
|
|
2269 |
: CalCommon::EThisAndAll );
|
|
2270 |
|
|
2271 |
TCalTime newInstanceStartDate, newInstanceEndDate;
|
|
2272 |
CalculateNewInstanceStartAndEndDateL( newInstanceStartDate,
|
|
2273 |
newInstanceEndDate );
|
|
2274 |
|
|
2275 |
TBool onDbChange = iEditorDataHandler->IsCalendarEditedL();
|
|
2276 |
if( iEditedCalEntry.EntryTypeL() != GetEntryType() || onDbChange)
|
|
2277 |
{
|
|
2278 |
TryToSaveEntryWithEntryChangeL( ETrue );
|
|
2279 |
}
|
|
2280 |
else
|
|
2281 |
{
|
|
2282 |
iEntryUpdater->UpdateInstanceL( EditorDataHandler().Entry(),
|
|
2283 |
*iOriginalCalEntry,
|
|
2284 |
EditorDataHandler().InstanceDateTime(),
|
|
2285 |
iRepeatType,
|
|
2286 |
newInstanceStartDate,
|
|
2287 |
newInstanceEndDate,
|
|
2288 |
iUnifiedEditorControl->GetCalendarNameForEntryL() );
|
|
2289 |
}
|
|
2290 |
}
|
|
2291 |
else
|
|
2292 |
{
|
|
2293 |
if ( action == CCalenEditorDataHandler::EActionDelete )
|
|
2294 |
{
|
|
2295 |
// FIXME, should we write date/time changes to entry?
|
|
2296 |
if ( !IsCreatingNewEntry() )
|
|
2297 |
{
|
|
2298 |
if( iHasChosenRepeatType && iRepeatType == CalCommon::EThisOnly )
|
|
2299 |
{
|
|
2300 |
iEntryUpdater->DeleteInstanceL( EditorDataHandler().Entry(), EditorDataHandler().CalenInstanceId() );
|
|
2301 |
}
|
|
2302 |
else
|
|
2303 |
{
|
|
2304 |
iEntryUpdater->DeleteEntryL( EditorDataHandler().Entry(), EditorDataHandler().CalenInstanceId() );
|
|
2305 |
}
|
|
2306 |
}
|
|
2307 |
}
|
|
2308 |
}
|
|
2309 |
}
|
|
2310 |
TRACE_EXIT_POINT;
|
|
2311 |
}
|
|
2312 |
|
|
2313 |
|
|
2314 |
// -----------------------------------------------------------------------------
|
|
2315 |
// CCalenUnifiedEditor::CalculateNewInstanceStartAndEndDateL
|
|
2316 |
// Calculate the new start and end time and date of the instance.
|
|
2317 |
// -----------------------------------------------------------------------------
|
|
2318 |
//
|
|
2319 |
void CCalenUnifiedEditor::CalculateNewInstanceStartAndEndDateL( TCalTime& aNewInstanceStartDate,
|
|
2320 |
TCalTime& aNewInstanceEndDate )
|
|
2321 |
{
|
|
2322 |
TRACE_ENTRY_POINT;
|
|
2323 |
|
|
2324 |
// Use floating time for non-timed entries
|
|
2325 |
if (EditorDataHandler().UseFloatingTimeL())
|
|
2326 |
{
|
|
2327 |
aNewInstanceStartDate.SetTimeLocalFloatingL( EditorDataHandler().Edited().StartDateTime() );
|
|
2328 |
aNewInstanceEndDate.SetTimeLocalFloatingL( EditorDataHandler().Edited().EndDateTime() );
|
|
2329 |
}
|
|
2330 |
else
|
|
2331 |
{
|
|
2332 |
aNewInstanceStartDate.SetTimeLocalL( EditorDataHandler().Edited().StartDateTime() );
|
|
2333 |
aNewInstanceEndDate.SetTimeLocalL( EditorDataHandler().Edited().EndDateTime() );
|
|
2334 |
}
|
|
2335 |
|
|
2336 |
TRACE_EXIT_POINT;
|
|
2337 |
}
|
|
2338 |
|
|
2339 |
// -----------------------------------------------------------------------------
|
|
2340 |
// CCalenUnifiedEditor::DisplayErrorMsgL
|
|
2341 |
// Display the given error message.
|
|
2342 |
// -----------------------------------------------------------------------------
|
|
2343 |
//
|
|
2344 |
void CCalenUnifiedEditor::DisplayErrorMsgL( const TInt& aError )
|
|
2345 |
{
|
|
2346 |
TRACE_ENTRY_POINT;
|
|
2347 |
TBool toContinue( ETrue );
|
|
2348 |
TInt resourceId( -1 );
|
|
2349 |
|
|
2350 |
switch ( aError )
|
|
2351 |
{
|
|
2352 |
case CCalenEditorDataHandler::EFormErrStopTimeEarlierThanStartTime:
|
|
2353 |
{
|
|
2354 |
resourceId = R_QTN_CALE_INFO_NOTE_ENDS_BEFORE;
|
|
2355 |
break;
|
|
2356 |
}
|
|
2357 |
case CCalenEditorDataHandler::EFormErrAlarmTimeLaterThanNote:
|
|
2358 |
{
|
|
2359 |
resourceId = R_QTN_CALE_LATER_DATE;
|
|
2360 |
break;
|
|
2361 |
}
|
|
2362 |
case CCalenEditorDataHandler::EFormErrAlarmTimePast:
|
|
2363 |
{
|
|
2364 |
resourceId = R_QTN_CALE_NOT_EXPIRED;
|
|
2365 |
break;
|
|
2366 |
}
|
|
2367 |
case CCalenEditorDataHandler::EFormErrAlarmDateTooManyDaysBeforeNote:
|
|
2368 |
{
|
|
2369 |
resourceId = R_QTN_CALE_DATE_ALARM_PAST;
|
|
2370 |
break;
|
|
2371 |
}
|
|
2372 |
case CCalenEditorDataHandler::EFormErrRepeatUntilEarlierThanNote:
|
|
2373 |
{
|
|
2374 |
resourceId = R_QTN_CALE_INFO_REPEAT_INVALID;
|
|
2375 |
break;
|
|
2376 |
}
|
|
2377 |
case CCalenEditorDataHandler::EFormErrDbConflictEntryModified:
|
|
2378 |
{//"Calendar database conflict. This entry has been modified by another application."
|
|
2379 |
DisplayErrorMsgInNoteDlgL( R_QTN_CALE_NOTE_DB_MODIFIED );
|
|
2380 |
toContinue = EFalse;
|
|
2381 |
break;
|
|
2382 |
}
|
|
2383 |
case CCalenEditorDataHandler::EFormErrDbConflictEntryDeleted:
|
|
2384 |
{//"Calendar database conflict. This entry has been deleted by another application."
|
|
2385 |
DisplayErrorMsgInNoteDlgL( R_QTN_CALE_NOTE_DB_CONFLICT );
|
|
2386 |
toContinue = EFalse;
|
|
2387 |
break;
|
|
2388 |
}
|
|
2389 |
case CCalenEditorDataHandler::EFormErrDurationGreaterThanRepeatInterval:
|
|
2390 |
{
|
|
2391 |
DispalyErrorMsgByRepeatTypeL();
|
|
2392 |
toContinue = EFalse;
|
|
2393 |
break;
|
|
2394 |
}
|
|
2395 |
case CCalenEditorDataHandler::EFormErrOverlapsExistingInstance:
|
|
2396 |
{
|
|
2397 |
resourceId = R_QTN_CALE_NOTE_CHILD_OVERLAP;
|
|
2398 |
break;
|
|
2399 |
}
|
|
2400 |
case CCalenEditorDataHandler::EFormErrOutOfSequence:
|
|
2401 |
{
|
|
2402 |
resourceId = R_QTN_CALE_NOTE_CHILD_OUT_OF_SEQUENCE;
|
|
2403 |
break;
|
|
2404 |
}
|
|
2405 |
case CCalenEditorDataHandler::EFormErrInstanceAlreadyExistsOnThisDay:
|
|
2406 |
{
|
|
2407 |
resourceId = R_QTN_CALE_NOTE_CHILD_SAME_DAY;
|
|
2408 |
break;
|
|
2409 |
}
|
|
2410 |
default:
|
|
2411 |
{
|
|
2412 |
toContinue = EFalse;
|
|
2413 |
}
|
|
2414 |
}
|
|
2415 |
if( toContinue )
|
|
2416 |
{
|
|
2417 |
CAknInformationNote* dialog = new ( ELeave ) CAknInformationNote();
|
|
2418 |
HBufC* buf = StringLoader::LoadLC( resourceId, iEikonEnv );
|
|
2419 |
dialog->ExecuteLD( *buf );
|
|
2420 |
CleanupStack::PopAndDestroy( buf );
|
|
2421 |
}
|
|
2422 |
|
|
2423 |
TRACE_EXIT_POINT;
|
|
2424 |
}
|
|
2425 |
|
|
2426 |
// -----------------------------------------------------------------------------
|
|
2427 |
// CCalenUnifiedEditor::ParentEntryL
|
|
2428 |
// Returns the parent entry of the entry being edited.
|
|
2429 |
// -----------------------------------------------------------------------------
|
|
2430 |
//
|
|
2431 |
CCalEntry& CCalenUnifiedEditor::ParentEntryL()
|
|
2432 |
{
|
|
2433 |
TRACE_ENTRY_POINT;
|
|
2434 |
TCalCollectionId colId = iEditorDataHandler->CurrentDbCollectionId();
|
|
2435 |
VerifyCollectionIdL(colId);
|
|
2436 |
|
|
2437 |
if( iFetchedEntries.Count() == 0 )
|
|
2438 |
{
|
|
2439 |
iServices->EntryViewL(colId)
|
|
2440 |
->FetchL( EditorDataHandler().Entry().UidL(), iFetchedEntries );
|
|
2441 |
}
|
|
2442 |
|
|
2443 |
TRACE_EXIT_POINT;
|
|
2444 |
return *iFetchedEntries[0];
|
|
2445 |
}
|
|
2446 |
|
|
2447 |
// -----------------------------------------------------------------------------
|
|
2448 |
// CCalenUnifiedEditor::DisplayErrorMsgInNoteDlgL
|
|
2449 |
// Display conflict error message.
|
|
2450 |
// -----------------------------------------------------------------------------
|
|
2451 |
//
|
|
2452 |
void CCalenUnifiedEditor::DisplayErrorMsgInNoteDlgL( TInt resourceId )
|
|
2453 |
{
|
|
2454 |
TRACE_ENTRY_POINT;
|
|
2455 |
|
|
2456 |
CAknNoteDialog *note = new(ELeave) CAknNoteDialog( CAknNoteDialog::EWarningTone,
|
|
2457 |
CAknNoteDialog::ENoTimeout );
|
|
2458 |
HBufC* buf = StringLoader::LoadLC( resourceId, iEikonEnv );
|
|
2459 |
note->SetTextL( *buf );
|
|
2460 |
note->ExecuteLD( R_CALEN_DB_CONFLICT_DIALOG );
|
|
2461 |
CleanupStack::PopAndDestroy( buf );
|
|
2462 |
|
|
2463 |
TRACE_EXIT_POINT;
|
|
2464 |
}
|
|
2465 |
|
|
2466 |
// -----------------------------------------------------------------------------
|
|
2467 |
// CCalenUnifiedEditor::DisplayErrorMsgByRepeatTypeL
|
|
2468 |
// Display conflict error message.
|
|
2469 |
// -----------------------------------------------------------------------------
|
|
2470 |
//
|
|
2471 |
void CCalenUnifiedEditor::DispalyErrorMsgByRepeatTypeL()
|
|
2472 |
{
|
|
2473 |
TRACE_ENTRY_POINT;
|
|
2474 |
|
|
2475 |
TTimeIntervalDays dur = Edited().EndDateTime().DaysFrom( Edited().StartDateTime() );
|
|
2476 |
CAknInformationNote* dialog = new (ELeave) CAknInformationNote();
|
|
2477 |
TInt resourceId( -1 );
|
|
2478 |
TBool toContinue( ETrue );
|
|
2479 |
// to find total num of days entry span .
|
|
2480 |
TInt numDaysEntrySpan = dur.Int() + 1 ;
|
|
2481 |
|
|
2482 |
switch( Edited().RepeatType() )
|
|
2483 |
{
|
|
2484 |
case ERepeatDaily:
|
|
2485 |
case ERepeatWorkdays:
|
|
2486 |
{
|
|
2487 |
resourceId = R_QTN_CALE_INFO_NOTE_DURATION_TOO_LONG_FOR_DAILY;
|
|
2488 |
}
|
|
2489 |
break;
|
|
2490 |
case ERepeatWeekly:
|
|
2491 |
{
|
|
2492 |
resourceId = R_QTN_CALE_INFO_NOTE_DURATION_TOO_LONG_FOR_WEEKLY;
|
|
2493 |
}
|
|
2494 |
break;
|
|
2495 |
case ERepeatBiWeekly:
|
|
2496 |
{
|
|
2497 |
resourceId = R_QTN_CALE_INFO_NOTE_DURATION_TOO_LONG_FOR_BIWEEKLY;
|
|
2498 |
}
|
|
2499 |
break;
|
|
2500 |
case ERepeatMonthly:
|
|
2501 |
{
|
|
2502 |
resourceId = R_QTN_CALE_INFO_NOTE_DURATION_TOO_LONG_FOR_MONTHLY;
|
|
2503 |
}
|
|
2504 |
break;
|
|
2505 |
case ERepeatYearly:
|
|
2506 |
{
|
|
2507 |
resourceId = R_QTN_CALE_INFO_NOTE_DURATION_TOO_LONG_FOR_YEARLY;
|
|
2508 |
}
|
|
2509 |
break;
|
|
2510 |
default:
|
|
2511 |
toContinue = EFalse;
|
|
2512 |
}
|
|
2513 |
if( toContinue )
|
|
2514 |
{
|
|
2515 |
HBufC* buf = StringLoader::LoadLC( resourceId,numDaysEntrySpan, iEikonEnv );
|
|
2516 |
dialog->ExecuteLD( *buf );
|
|
2517 |
CleanupStack::PopAndDestroy( buf );
|
|
2518 |
}
|
|
2519 |
else
|
|
2520 |
{
|
|
2521 |
CleanupStack::PopAndDestroy( dialog );
|
|
2522 |
}
|
|
2523 |
|
|
2524 |
TRACE_EXIT_POINT;
|
|
2525 |
}
|
|
2526 |
|
|
2527 |
// -----------------------------------------------------------------------------
|
|
2528 |
// CCalenUnifiedEditor::EntryStillExistsL
|
|
2529 |
// Checks the entry still exists in the database. If the entry has been
|
|
2530 |
// removed or modified, the appropriate action is returned.
|
|
2531 |
// -----------------------------------------------------------------------------
|
|
2532 |
//
|
|
2533 |
CCalenUnifiedEditor::TEntryExistenceStatus CCalenUnifiedEditor::EntryStillExistsL()
|
|
2534 |
{
|
|
2535 |
TRACE_ENTRY_POINT;
|
|
2536 |
TEntryExistenceStatus status = EEntryOk;
|
|
2537 |
|
|
2538 |
// Check to see if the entry open in the editor still exists
|
|
2539 |
if ( iLastDbChangeNotification >= iTimeStamp )
|
|
2540 |
{
|
|
2541 |
// The database was changed through another session while the editor was open.
|
|
2542 |
// Search for our entry to check it still exists.
|
|
2543 |
|
|
2544 |
CCalEntry* dbEntry = NULL;
|
|
2545 |
for(TInt i = 0 ;i < iCollectionIds.Count() ; i++)
|
|
2546 |
{
|
|
2547 |
//check the exsists in one of the calendars
|
|
2548 |
PIM_TRAPD_HANDLE( ( dbEntry = iServices->EntryViewL(iCollectionIds[i])
|
|
2549 |
->FetchL( iOriginalCalEntry->LocalUidL() ) ) );
|
|
2550 |
if(dbEntry)
|
|
2551 |
{
|
|
2552 |
break;
|
|
2553 |
}
|
|
2554 |
}
|
|
2555 |
|
|
2556 |
// I would have thought we could check for KErrNotFound here, but we just get a NULL
|
|
2557 |
// entry returned if it doesn't exist anymore.
|
|
2558 |
if ( !dbEntry )
|
|
2559 |
{
|
|
2560 |
// The entry we are editing has been deleted.
|
|
2561 |
status = EEntryDeletedByAnotherProcess;
|
|
2562 |
}
|
|
2563 |
else
|
|
2564 |
{
|
|
2565 |
CleanupStack::PushL( dbEntry );
|
|
2566 |
//Check the last modified time of the entry we retrieved from the database
|
|
2567 |
if ( dbEntry->LastModifiedDateL().TimeUtcL() >= iTimeStamp )
|
|
2568 |
{
|
|
2569 |
// This entry has been modified in some way, but not by us.
|
|
2570 |
// Abandon our changes
|
|
2571 |
status = EEntryModifiedByAnotherProcess;
|
|
2572 |
}
|
|
2573 |
CleanupStack::PopAndDestroy( dbEntry );
|
|
2574 |
}
|
|
2575 |
}
|
|
2576 |
|
|
2577 |
TRACE_EXIT_POINT;
|
|
2578 |
return status;
|
|
2579 |
}
|
|
2580 |
|
|
2581 |
// -----------------------------------------------------------------------------
|
|
2582 |
// CCalenUnifiedEditor::UpdateLocationInfoToFormL
|
|
2583 |
// Updates the user selected landmark details into current meeting editor form
|
|
2584 |
// -----------------------------------------------------------------------------
|
|
2585 |
//
|
|
2586 |
void CCalenUnifiedEditor::UpdateLocationInfoToFormL()
|
|
2587 |
{
|
|
2588 |
TRACE_ENTRY_POINT;
|
|
2589 |
// set the focus to location field as the address is inserted/updated to location field.
|
|
2590 |
TryChangeFocusToL(ECalenEditorPlace);
|
|
2591 |
// Get location details from context
|
|
2592 |
MCalenContext& context = iServices->Context();
|
|
2593 |
CPosLandmark* landmark = context.GetLandMark();
|
|
2594 |
TBuf<ECalenAbsoluteMaxTextEditorLength> locationInfo;
|
|
2595 |
GetEdwinText(locationInfo, ECalenEditorPlace);
|
|
2596 |
if(landmark) // If user has selected location from Map
|
|
2597 |
{
|
|
2598 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
2599 |
GetEdwinText(location, ECalenEditorPlace);
|
|
2600 |
CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
|
|
2601 |
if(geoValue || isReplaceLocation)
|
|
2602 |
{
|
|
2603 |
isReplaceLocation = EFalse;
|
|
2604 |
HandleEntryWithGeoValueEditionL(landmark);
|
|
2605 |
delete geoValue;
|
|
2606 |
}
|
|
2607 |
else if(locationInfo.Length() && !isReplaceLocation)
|
|
2608 |
{
|
|
2609 |
HandleEntryWithLocationEditionL(landmark);
|
|
2610 |
}
|
|
2611 |
else // This is the new entry being created and nothing is there in location field
|
|
2612 |
{
|
|
2613 |
isReplaceLocation = EFalse;
|
|
2614 |
StoreLocationDetailsToEntryL(landmark);
|
|
2615 |
}
|
|
2616 |
}
|
|
2617 |
|
|
2618 |
TRACE_EXIT_POINT;
|
|
2619 |
}
|
|
2620 |
|
|
2621 |
// -----------------------------------------------------------------------------
|
|
2622 |
// CCalenUnifiedEditor::HandleEntryWithGeoValueEditionL
|
|
2623 |
// Shows suery to the user to replace gthe exisitng saved address
|
|
2624 |
// -----------------------------------------------------------------------------
|
|
2625 |
//
|
|
2626 |
void CCalenUnifiedEditor::HandleEntryWithGeoValueEditionL(CPosLandmark* landmark)
|
|
2627 |
{
|
|
2628 |
TRACE_ENTRY_POINT;
|
|
2629 |
|
|
2630 |
// User is tyring to update the location field of an entry which
|
|
2631 |
// already has location text as well as geo coordinates
|
|
2632 |
TPtrC locationName;
|
|
2633 |
landmark->GetLandmarkName(locationName);
|
|
2634 |
TInt userResponse = ShowLocationReplaceNoticeL(locationName);
|
|
2635 |
if(userResponse)
|
|
2636 |
{
|
|
2637 |
StoreLocationDetailsToEntryL(landmark);
|
|
2638 |
}
|
|
2639 |
|
|
2640 |
TRACE_EXIT_POINT;
|
|
2641 |
}
|
|
2642 |
|
|
2643 |
// -----------------------------------------------------------------------------
|
|
2644 |
// CCalenUnifiedEditor::HandleEntryWithLocationEditionL
|
|
2645 |
// Shows suery to the user to replace gthe exisitng saved address
|
|
2646 |
// -----------------------------------------------------------------------------
|
|
2647 |
//
|
|
2648 |
void CCalenUnifiedEditor::HandleEntryWithLocationEditionL(CPosLandmark* landmark)
|
|
2649 |
{
|
|
2650 |
TRACE_ENTRY_POINT;
|
|
2651 |
|
|
2652 |
// User is tyring to update the location field of an entry which
|
|
2653 |
// already has location text as well as geo coordinates
|
|
2654 |
TBuf<ECalenAbsoluteMaxTextEditorLength> locationInfo;
|
|
2655 |
GetEdwinText(locationInfo, ECalenEditorPlace);
|
|
2656 |
TPtrC landmarkname;
|
|
2657 |
landmark->GetLandmarkName(landmarkname);
|
|
2658 |
RPointerArray<HBufC> locationStrings;
|
|
2659 |
HBufC* oldLocation = HBufC::NewL(MaxTextEditorLength());
|
|
2660 |
oldLocation->Des().Copy(locationInfo);
|
|
2661 |
|
|
2662 |
HBufC* oldNewLocation = HBufC::NewL(MaxTextEditorLength());
|
|
2663 |
TBuf<2*ECalenAbsoluteMaxTextEditorLength> combLocation;
|
|
2664 |
combLocation.Append(locationInfo);
|
|
2665 |
combLocation.Append(KComma);
|
|
2666 |
combLocation.Append(landmarkname);
|
|
2667 |
oldNewLocation->Des().Copy(combLocation.Left(MaxTextEditorLength()));
|
|
2668 |
|
|
2669 |
HBufC* newLocation = HBufC::NewL(MaxTextEditorLength());
|
|
2670 |
newLocation->Des().Copy(landmarkname);
|
|
2671 |
locationStrings.Append(oldNewLocation);
|
|
2672 |
locationStrings.Append(newLocation);
|
|
2673 |
locationStrings.Append(oldLocation);
|
|
2674 |
TInt userResponse = CCalenLocationUtil::ShowLocationAppendOrReplaceL(locationStrings);
|
|
2675 |
locationStrings.ResetAndDestroy();
|
|
2676 |
if(userResponse == KErrCancel)
|
|
2677 |
{
|
|
2678 |
return;
|
|
2679 |
}
|
|
2680 |
switch(userResponse)
|
|
2681 |
{
|
|
2682 |
case 0:
|
|
2683 |
{
|
|
2684 |
landmark->SetLandmarkNameL(combLocation.Left(MaxTextEditorLength()));
|
|
2685 |
}
|
|
2686 |
break;
|
|
2687 |
case 1:
|
|
2688 |
{
|
|
2689 |
landmark->SetLandmarkNameL(landmarkname);
|
|
2690 |
}
|
|
2691 |
break;
|
|
2692 |
case 2:
|
|
2693 |
{
|
|
2694 |
landmark->SetLandmarkNameL(locationInfo);
|
|
2695 |
}
|
|
2696 |
break;
|
|
2697 |
default:
|
|
2698 |
break;
|
|
2699 |
}
|
|
2700 |
StoreLocationDetailsToEntryL(landmark);
|
|
2701 |
|
|
2702 |
TRACE_EXIT_POINT;
|
|
2703 |
}
|
|
2704 |
|
|
2705 |
// -----------------------------------------------------------------------------
|
|
2706 |
// CCalenUnifiedEditor::StoreLocationDetailsToEntryL
|
|
2707 |
// Stores landmark details and displays selected location details on the
|
|
2708 |
// currently shown editor form
|
|
2709 |
// -----------------------------------------------------------------------------
|
|
2710 |
//
|
|
2711 |
void CCalenUnifiedEditor::StoreLocationDetailsToEntryL(CPosLandmark* landmark)
|
|
2712 |
{
|
|
2713 |
TRACE_ENTRY_POINT;
|
|
2714 |
|
|
2715 |
TLocality position;
|
|
2716 |
landmark->GetPosition(position);
|
|
2717 |
|
|
2718 |
TBuf<ECalenAbsoluteMaxTextEditorLength> existingLocationInfo;
|
|
2719 |
GetEdwinText(existingLocationInfo, ECalenEditorPlace);
|
|
2720 |
|
|
2721 |
//Store the geo coordinates
|
|
2722 |
CCalGeoValue* geoValue = CCalGeoValue::NewL();
|
|
2723 |
geoValue->SetLatLongL( position.Latitude(), position.Longitude() );
|
|
2724 |
EditorDataHandler().Entry().SetGeoValueL( *geoValue );
|
|
2725 |
delete geoValue;
|
|
2726 |
|
|
2727 |
TBuf<ECalenAbsoluteMaxTextEditorLength> locationDetails;
|
|
2728 |
TPtrC landmarkname;
|
|
2729 |
landmark->GetLandmarkName( landmarkname );
|
|
2730 |
locationDetails.Append( landmarkname );
|
|
2731 |
|
|
2732 |
TPtrC landmarkDesc;
|
|
2733 |
landmark->GetLandmarkDescription( landmarkDesc );
|
|
2734 |
if( landmarkDesc.Size() )
|
|
2735 |
{
|
|
2736 |
locationDetails.Append( KComma );
|
|
2737 |
locationDetails.Append( landmarkDesc );
|
|
2738 |
}
|
|
2739 |
|
|
2740 |
Edited().SetLocationL( locationDetails.Left( MaxTextEditorLength()) );
|
|
2741 |
|
|
2742 |
TPtrC location = Edited().Location().Left( MaxTextEditorLength() );
|
|
2743 |
EditorDataHandler().Entry().SetLocationL( location );
|
|
2744 |
|
|
2745 |
SetEdwinTextL(ECalenEditorPlace, &location);
|
|
2746 |
if(existingLocationInfo.Length())
|
|
2747 |
{
|
|
2748 |
ShowAddressUpdatedNoticeL();
|
|
2749 |
}
|
|
2750 |
|
|
2751 |
|
|
2752 |
TRACE_EXIT_POINT;
|
|
2753 |
}
|
|
2754 |
|
|
2755 |
// ----------------------------------------------------------------------------
|
|
2756 |
// CCalenUnifiedEditor::ShowLocationReplaceNoticeL
|
|
2757 |
// Function to query user whether to replace or keep existing location details
|
|
2758 |
// (other items were commented in a header).
|
|
2759 |
// ----------------------------------------------------------------------------
|
|
2760 |
//
|
|
2761 |
TInt CCalenUnifiedEditor::ShowLocationReplaceNoticeL(TPtrC aLocationName)
|
|
2762 |
{
|
|
2763 |
TRACE_ENTRY_POINT;
|
|
2764 |
|
|
2765 |
CAknQueryDialog *dialog = CAknQueryDialog::NewL( );
|
|
2766 |
CleanupStack::PushL( dialog );
|
|
2767 |
TInt resID = R_CALEN_QTN_REPLACE_LOCATION;
|
|
2768 |
|
|
2769 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
2770 |
TChar quote = '"';
|
|
2771 |
location.Append(quote);
|
|
2772 |
location.Append(aLocationName);
|
|
2773 |
location.Append(quote);
|
|
2774 |
|
|
2775 |
CEikonEnv* eikEnv = CEikonEnv::Static();
|
|
2776 |
|
|
2777 |
HBufC* prompt = StringLoader::LoadLC( resID, location, eikEnv );
|
|
2778 |
|
|
2779 |
dialog->SetPromptL( *prompt );
|
|
2780 |
CleanupStack::PopAndDestroy( prompt );
|
|
2781 |
|
|
2782 |
CleanupStack::Pop( dialog );
|
|
2783 |
|
|
2784 |
return dialog->ExecuteLD( R_CALEN_LOCATION_REPLACE_NOTE );
|
|
2785 |
|
|
2786 |
TRACE_EXIT_POINT;
|
|
2787 |
}
|
|
2788 |
|
|
2789 |
// ----------------------------------------------------------------------------
|
|
2790 |
// CCalenUnifiedEditor::ShowAddressUpdatedNoticeL
|
|
2791 |
// Displays "Address Updated" transient notice
|
|
2792 |
// (other items were commented in a header).
|
|
2793 |
// ----------------------------------------------------------------------------
|
|
2794 |
//
|
|
2795 |
void CCalenUnifiedEditor::ShowAddressUpdatedNoticeL()
|
|
2796 |
{
|
|
2797 |
HBufC* buf = StringLoader::LoadLC( R_CALEN_QTN_ADDRESS_UPDATED, CEikonEnv::Static() );
|
|
2798 |
CAknConfirmationNote* dialog = new( ELeave ) CAknConfirmationNote();
|
|
2799 |
dialog->ExecuteLD(*buf);
|
|
2800 |
CleanupStack::PopAndDestroy( buf );
|
|
2801 |
}
|
|
2802 |
|
|
2803 |
// -----------------------------------------------------------------------------
|
|
2804 |
// CCalenUnifiedEditor::CheckManualEditionOfLocationL
|
|
2805 |
// Checks if user has edited location field manually
|
|
2806 |
// -----------------------------------------------------------------------------
|
|
2807 |
//
|
|
2808 |
void CCalenUnifiedEditor::CheckManualEditionOfLocationL()
|
|
2809 |
{
|
|
2810 |
TRACE_ENTRY_POINT;
|
|
2811 |
|
|
2812 |
CCalEntry& entry = EditorDataHandler().Entry();
|
|
2813 |
CCalGeoValue* geoValue = entry.GeoValueL();
|
|
2814 |
if( !geoValue )
|
|
2815 |
{
|
|
2816 |
return;
|
|
2817 |
}
|
|
2818 |
delete geoValue;
|
|
2819 |
|
|
2820 |
TPtrC entryLocation = entry.LocationL();
|
|
2821 |
TBuf<ECalenAbsoluteMaxTextEditorLength> location;
|
|
2822 |
location.Copy(Edited().Location());
|
|
2823 |
|
|
2824 |
if( entryLocation != location )
|
|
2825 |
{
|
|
2826 |
// USer has manually edited the location field
|
|
2827 |
TInt response = ShowLocationChangeNoticeL();
|
|
2828 |
if( !response )
|
|
2829 |
{
|
|
2830 |
// Clear the geo coordinates for the entry
|
|
2831 |
entry.ClearGeoValueL();
|
|
2832 |
Edited().SetLocationL( location );
|
|
2833 |
EditorDataHandler().Entry().SetLocationL(location);
|
|
2834 |
SetEdwinTextL(ECalenEditorPlace, &location);
|
|
2835 |
}
|
|
2836 |
else
|
|
2837 |
{
|
|
2838 |
EditorDataHandler().Entry().SetLocationL(location);
|
|
2839 |
}
|
|
2840 |
}
|
|
2841 |
|
|
2842 |
TRACE_EXIT_POINT;
|
|
2843 |
}
|
|
2844 |
|
|
2845 |
// -----------------------------------------------------------------------------
|
|
2846 |
// CCalenUnifiedEditor::ShowLocationChangeNoticeL
|
|
2847 |
// Queries user whether to keep the exisiting coordianates or not
|
|
2848 |
// -----------------------------------------------------------------------------
|
|
2849 |
//
|
|
2850 |
TInt CCalenUnifiedEditor::ShowLocationChangeNoticeL()
|
|
2851 |
{
|
|
2852 |
TRACE_ENTRY_POINT;
|
|
2853 |
|
|
2854 |
CAknQueryDialog *dialog = CAknQueryDialog::NewL( );
|
|
2855 |
CleanupStack::PushL( dialog );
|
|
2856 |
TInt resID = R_CALEN_QTN_GEOVALUES_REMOVAL;
|
|
2857 |
|
|
2858 |
HBufC* prompt;
|
|
2859 |
prompt = StringLoader::LoadLC( resID, iCoeEnv );
|
|
2860 |
dialog->SetPromptL( *prompt );
|
|
2861 |
CleanupStack::PopAndDestroy( prompt );
|
|
2862 |
CleanupStack::Pop( dialog );
|
|
2863 |
|
|
2864 |
return dialog->ExecuteLD( R_CALEN_GEOVALUES_REMOVAL_NOTE );
|
|
2865 |
TRACE_EXIT_POINT;
|
|
2866 |
}
|
|
2867 |
|
|
2868 |
// -----------------------------------------------------------------------------
|
|
2869 |
// CCalenUnifiedEditor::UpdateAttachmentInfoToEditorL
|
|
2870 |
// Update attachment info to editor whenever an file is selected
|
|
2871 |
// -----------------------------------------------------------------------------
|
|
2872 |
//
|
|
2873 |
void CCalenUnifiedEditor::UpdateAttachmentInfoToEditorL()
|
|
2874 |
{
|
|
2875 |
TRACE_ENTRY_POINT;
|
|
2876 |
const TDesC& emptyText = KEmpty;
|
|
2877 |
SetEdwinTextL(ECalenEditorAttachment, &emptyText);
|
|
2878 |
|
|
2879 |
TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems();
|
|
2880 |
if( attachmentCount )
|
|
2881 |
{
|
|
2882 |
RPointerArray<CCalenAttachmentInfo> attachmentInfoList;
|
|
2883 |
iServices->GetAttachmentData()->GetAttachmentListL(attachmentInfoList);
|
|
2884 |
|
|
2885 |
TInt attachmentLength(0);
|
|
2886 |
for( TInt index =0; index<attachmentCount; index++ )
|
|
2887 |
{
|
|
2888 |
if(index>0)
|
|
2889 |
{
|
|
2890 |
attachmentLength++;
|
|
2891 |
}
|
|
2892 |
CCalenAttachmentInfo* attachmentInfo = attachmentInfoList[index];
|
|
2893 |
TParsePtrC fileNameParser( attachmentInfo->FileName() );
|
|
2894 |
attachmentLength += fileNameParser.NameAndExt().Length();
|
|
2895 |
}
|
|
2896 |
|
|
2897 |
// Additional space is for appending "; " after each attachment to separate multiple attachments
|
|
2898 |
HBufC* attachmentNames = HBufC::NewLC( attachmentLength +
|
|
2899 |
( attachmentCount - 1 ) * KAttachmentSeparator.iTypeLength );
|
|
2900 |
CleanupStack::Pop( attachmentNames );
|
|
2901 |
TPtr ptr( attachmentNames->Des() );
|
|
2902 |
for( TInt index=0; index<attachmentCount; index++ )
|
|
2903 |
{
|
|
2904 |
if( index>0 )
|
|
2905 |
{
|
|
2906 |
ptr.Append( KAttachmentSeparator );
|
|
2907 |
}
|
|
2908 |
CCalenAttachmentInfo* attachmentInfo = attachmentInfoList[index];
|
|
2909 |
TParsePtrC fileNameParser( attachmentInfo->FileName()) ;
|
|
2910 |
ptr.Append( fileNameParser.NameAndExt() );
|
|
2911 |
}
|
|
2912 |
|
|
2913 |
SetUnderLineForAttachmentL( EUnderlineOn );
|
|
2914 |
SetEdwinTextL( ECalenEditorAttachment, &ptr );
|
|
2915 |
delete attachmentNames;
|
|
2916 |
|
|
2917 |
attachmentInfoList.Close();
|
|
2918 |
UpdateFormL();
|
|
2919 |
}
|
|
2920 |
|
|
2921 |
// Update the attachment cound in editedentryutil as attachment would have added or deleted
|
|
2922 |
CheckForAttachmentsInEditorL();
|
|
2923 |
TRACE_EXIT_POINT;
|
|
2924 |
}
|
|
2925 |
|
|
2926 |
// -----------------------------------------------------------------------------
|
|
2927 |
// CCalenUnifiedEditor::SetUnderLineForAttachmentL
|
|
2928 |
// Sets the undeline for the attachment field's text
|
|
2929 |
// -----------------------------------------------------------------------------
|
|
2930 |
//
|
|
2931 |
void CCalenUnifiedEditor::SetUnderLineForAttachmentL( TFontUnderline aUnderLine )
|
|
2932 |
{
|
|
2933 |
TRACE_ENTRY_POINT;
|
|
2934 |
|
|
2935 |
CEikRichTextEditor* attachmentControl = static_cast<CEikRichTextEditor*>(
|
|
2936 |
Control( ECalenEditorAttachment ) );
|
|
2937 |
TCharFormat charFormat;
|
|
2938 |
TCharFormatMask charFormatMask;
|
|
2939 |
charFormatMask.SetAttrib( EAttFontUnderline );
|
|
2940 |
charFormat.iFontPresentation.iUnderline = aUnderLine;
|
|
2941 |
|
|
2942 |
attachmentControl->ApplyCharFormatL( charFormat,charFormatMask );
|
|
2943 |
attachmentControl->HandleTextChangedL();
|
|
2944 |
TRACE_EXIT_POINT;
|
|
2945 |
}
|
|
2946 |
|
|
2947 |
// -----------------------------------------------------------------------------
|
|
2948 |
// CCalenUnifiedEditor::GetAttachmentNamesString
|
|
2949 |
// Merges individual attachment names into a single string
|
|
2950 |
// -----------------------------------------------------------------------------
|
|
2951 |
//
|
|
2952 |
void CCalenUnifiedEditor::GetAttachmentNamesString( RPointerArray<HBufC>& aAttachmentNames,
|
|
2953 |
HBufC& aAttachmentNamesString)
|
|
2954 |
{
|
|
2955 |
TRACE_ENTRY_POINT;
|
|
2956 |
TInt attachmentCount = aAttachmentNames.Count();
|
|
2957 |
TPtr ptr( aAttachmentNamesString.Des() );
|
|
2958 |
for( TInt index=0; index<attachmentCount; index++ )
|
|
2959 |
{
|
|
2960 |
if( index>0 )
|
|
2961 |
{
|
|
2962 |
ptr.Append( KAttachmentSeparator );
|
|
2963 |
}
|
|
2964 |
ptr.Append( aAttachmentNames[index]->Des() );
|
|
2965 |
}
|
|
2966 |
TRACE_EXIT_POINT;
|
|
2967 |
}
|
|
2968 |
|
|
2969 |
// -----------------------------------------------------------------------------
|
|
2970 |
// CCalenUnifiedEditor::CheckForAttachmentsInEditorL
|
|
2971 |
// Check for attachments in editor,if present save the attachment count which is
|
|
2972 |
// used while saving the attachments to the calentry
|
|
2973 |
// -----------------------------------------------------------------------------
|
|
2974 |
//
|
|
2975 |
void CCalenUnifiedEditor::CheckForAttachmentsInEditorL()
|
|
2976 |
{
|
|
2977 |
TRACE_ENTRY_POINT;
|
|
2978 |
|
|
2979 |
TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems();
|
|
2980 |
Edited().SetAttachmentCount( attachmentCount );
|
|
2981 |
|
|
2982 |
TRACE_EXIT_POINT;
|
|
2983 |
}
|
|
2984 |
|
|
2985 |
// -----------------------------------------------------------------------------
|
|
2986 |
// CCalenUnifiedEditor::SetAttachmentNamesToEditorL
|
|
2987 |
// Set attachment names to the editor,if entry is already having the attachments
|
|
2988 |
// and is being opened in editor
|
|
2989 |
// -----------------------------------------------------------------------------
|
|
2990 |
//
|
|
2991 |
void CCalenUnifiedEditor::SetAttachmentNamesToEditorL()
|
|
2992 |
{
|
|
2993 |
TRACE_ENTRY_POINT;
|
|
2994 |
TInt attachmentCount = Edited().AttachmentCount();
|
|
2995 |
if( attachmentCount )
|
|
2996 |
{
|
|
2997 |
RPointerArray<HBufC> attachmentNames;
|
|
2998 |
CleanupResetAndDestroyPushL(attachmentNames);
|
|
2999 |
GetAttachmentNamesL(attachmentNames);
|
|
3000 |
attachmentCount = attachmentNames.Count();
|
|
3001 |
TInt attachmentLength(0);
|
|
3002 |
for( TInt index =0; index<attachmentCount; index++ )
|
|
3003 |
{
|
|
3004 |
if(index>0)
|
|
3005 |
{
|
|
3006 |
attachmentLength++;
|
|
3007 |
}
|
|
3008 |
|
|
3009 |
attachmentLength += attachmentNames[index]->Length();
|
|
3010 |
// We need two extra spaces for adding "; " between multiple attachments
|
|
3011 |
attachmentLength += KAttachmentSeparator.iTypeLength;
|
|
3012 |
}
|
|
3013 |
|
|
3014 |
HBufC* attachmentNamesString = HBufC::NewLC( attachmentLength );
|
|
3015 |
CleanupStack::Pop( attachmentNamesString );
|
|
3016 |
GetAttachmentNamesString(attachmentNames, *attachmentNamesString);
|
|
3017 |
|
|
3018 |
SetUnderLineForAttachmentL( EUnderlineOn );
|
|
3019 |
SetEdwinTextL( ECalenEditorAttachment, attachmentNamesString );
|
|
3020 |
|
|
3021 |
// Cleanup
|
|
3022 |
delete attachmentNamesString;
|
|
3023 |
CleanupStack::PopAndDestroy(&attachmentNames);
|
|
3024 |
}
|
|
3025 |
|
|
3026 |
TRACE_EXIT_POINT;
|
|
3027 |
}
|
|
3028 |
|
|
3029 |
// -----------------------------------------------------------------------------
|
|
3030 |
// CCalenUnifiedEditor::EntryHasAttachments
|
|
3031 |
// check whether the entry has attachments or not
|
|
3032 |
// -----------------------------------------------------------------------------
|
|
3033 |
//
|
|
3034 |
TBool CCalenUnifiedEditor::EntryHasAttachments()
|
|
3035 |
{
|
|
3036 |
TRACE_ENTRY_POINT;
|
|
3037 |
TBool attachmentExists(EFalse);
|
|
3038 |
TInt attachmentCountFromModel = iServices->GetAttachmentData()->NumberOfItems();
|
|
3039 |
if( Edited().AttachmentCount() || attachmentCountFromModel )
|
|
3040 |
{
|
|
3041 |
attachmentExists = ETrue;
|
|
3042 |
}
|
|
3043 |
TRACE_EXIT_POINT;
|
|
3044 |
|
|
3045 |
return attachmentExists;
|
|
3046 |
}
|
|
3047 |
|
|
3048 |
// -----------------------------------------------------------------------------
|
|
3049 |
// CCalenController::GetAllCollectionidsL
|
|
3050 |
// -----------------------------------------------------------------------------
|
|
3051 |
//
|
|
3052 |
void CCalenUnifiedEditor::GetAllCollectionidsL(
|
|
3053 |
RArray<TInt>& aCollectionIds)
|
|
3054 |
{
|
|
3055 |
TRACE_ENTRY_POINT
|
|
3056 |
RPointerArray<CCalCalendarInfo> calendarInfoList;
|
|
3057 |
CleanupClosePushL(calendarInfoList);
|
|
3058 |
iServices->GetAllCalendarInfoL(calendarInfoList);
|
|
3059 |
|
|
3060 |
for(TInt index=0;index<calendarInfoList.Count();index++)
|
|
3061 |
{
|
|
3062 |
aCollectionIds.Append( iServices->SessionL(
|
|
3063 |
calendarInfoList[index]->FileNameL() ).CollectionIdL() );
|
|
3064 |
}
|
|
3065 |
|
|
3066 |
CleanupStack::PopAndDestroy(&calendarInfoList);
|
|
3067 |
TRACE_EXIT_POINT
|
|
3068 |
}
|
|
3069 |
// -----------------------------------------------------------------------------
|
|
3070 |
// From CEikDialog
|
|
3071 |
// We will hit this event each time a line has changed in the form
|
|
3072 |
// -----------------------------------------------------------------------------
|
|
3073 |
//
|
|
3074 |
void CCalenUnifiedEditor::LineChangedL( TInt /* aControlId */ )
|
|
3075 |
{
|
|
3076 |
TRACE_ENTRY_POINT;
|
|
3077 |
|
|
3078 |
SetMskFromResourceL();
|
|
3079 |
TRACE_EXIT_POINT;
|
|
3080 |
}
|
|
3081 |
|
|
3082 |
|
|
3083 |
// -----------------------------------------------------------------------------
|
|
3084 |
// Update CBA with corresponding MSK button.
|
|
3085 |
// This function is e.g. called from HanleControlEvent()
|
|
3086 |
// Will issue HandleControlStateChangeL() call.
|
|
3087 |
// -----------------------------------------------------------------------------
|
|
3088 |
//
|
|
3089 |
void CCalenUnifiedEditor::SetMskFromResourceL()
|
|
3090 |
{
|
|
3091 |
TRACE_ENTRY_POINT;
|
|
3092 |
CEikButtonGroupContainer& cba = ButtonGroupContainer ();
|
|
3093 |
TInt resid=0;
|
|
3094 |
TInt ctrlid=IdOfFocusControl();
|
|
3095 |
|
|
3096 |
switch( ctrlid )
|
|
3097 |
{
|
|
3098 |
|
|
3099 |
// for these fields we use change button
|
|
3100 |
case ECalenEditorReminder: /* fall through... */
|
|
3101 |
case ECalenEditorRepeat: /* fall through... */
|
|
3102 |
|
|
3103 |
resid=R_CALEN_MSK_CHANGE_CBA;
|
|
3104 |
break;
|
|
3105 |
// for description field it is open
|
|
3106 |
case ECalenEditorDescription:
|
|
3107 |
// resid=R_CALEN_MSK_OPEN_CBA;
|
|
3108 |
// break;
|
|
3109 |
// for location field
|
|
3110 |
case ECalenEditorPlace:
|
|
3111 |
if(CCalenLocationUtil::IsMapProviderAvailableL())
|
|
3112 |
{
|
|
3113 |
resid = R_CALEN_MSK_FROMMAP_CBA;
|
|
3114 |
}
|
|
3115 |
else
|
|
3116 |
{
|
|
3117 |
resid=R_CALEN_MSK_EMPTY_CBA;
|
|
3118 |
}
|
|
3119 |
break;
|
|
3120 |
// otherwise use empty MSK
|
|
3121 |
case ECalenEditorSubject: /* fall through... */
|
|
3122 |
case ECalenEditorReminderDate:
|
|
3123 |
case ECalenEditorReminderTime: /* fall through... */
|
|
3124 |
case ECalenEditorEndDate: /* fall through... */
|
|
3125 |
case ECalenEditorEndTime:
|
|
3126 |
case ECalenEditorDueDate:
|
|
3127 |
case ECalenEditorStartDate:
|
|
3128 |
case ECalenEditorStartTime:
|
|
3129 |
case ECalenEditorBirthDayYear:
|
|
3130 |
default:
|
|
3131 |
resid=R_CALEN_MSK_EMPTY_CBA;
|
|
3132 |
break;
|
|
3133 |
|
|
3134 |
case ECalenEditorRepeatUntil:
|
|
3135 |
case ECalenEditorAllDayItem:
|
|
3136 |
case ECalenEditorEventType:
|
|
3137 |
case ECalenEditorDBName:
|
|
3138 |
case ECalenEditorPriority:
|
|
3139 |
resid=R_CALEN_MSK_CHANGE_CBA;
|
|
3140 |
|
|
3141 |
}
|
|
3142 |
|
|
3143 |
|
|
3144 |
// set desired CBA
|
|
3145 |
cba.SetCommandSetL(resid);
|
|
3146 |
cba.DrawNow();
|
|
3147 |
|
|
3148 |
TRACE_EXIT_POINT;
|
|
3149 |
}
|
|
3150 |
|
|
3151 |
// -----------------------------------------------------------------------------
|
|
3152 |
// CCalenUnifiedEditor::VerifyCollectionId
|
|
3153 |
// Verify if the collectionid exsists in the array of collecteids
|
|
3154 |
// -----------------------------------------------------------------------------
|
|
3155 |
//
|
|
3156 |
void CCalenUnifiedEditor::VerifyCollectionIdL(const TCalCollectionId aColId)
|
|
3157 |
{
|
|
3158 |
TRACE_ENTRY_POINT
|
|
3159 |
TInt errVal = KErrNotFound;
|
|
3160 |
errVal = iCollectionIds.Find((TInt)aColId);
|
|
3161 |
User::LeaveIfError(errVal);
|
|
3162 |
TRACE_EXIT_POINT
|
|
3163 |
}
|
|
3164 |
|
|
3165 |
// -----------------------------------------------------------------------------
|
|
3166 |
// CCalenUnifiedEditor::ModifyDbField
|
|
3167 |
// modifies the DB filed in cenrep if user has edited it.
|
|
3168 |
// -----------------------------------------------------------------------------
|
|
3169 |
//
|
|
3170 |
void CCalenUnifiedEditor::ModifyDbFieldL()
|
|
3171 |
{
|
|
3172 |
if(IsCreatingNewEntry())
|
|
3173 |
{
|
|
3174 |
RPointerArray<CCalCalendarInfo> calendarInfoList;
|
|
3175 |
iServices->GetAllCalendarInfoL(calendarInfoList);
|
|
3176 |
CleanupClosePushL( calendarInfoList );
|
|
3177 |
TInt pos = iUnifiedEditorControl->GetCalendarIndexForEntryL();
|
|
3178 |
TPtrC lastUsedCalendarName = calendarInfoList[pos]->FileNameL();
|
|
3179 |
CleanupStack::PopAndDestroy( &calendarInfoList );
|
|
3180 |
|
|
3181 |
CRepository* cenRep = CRepository::NewLC(KCRUidCalendar);
|
|
3182 |
User::LeaveIfError( cenRep->Set( KCalendarLastUsedCalendar, lastUsedCalendarName ) );
|
|
3183 |
CleanupStack::PopAndDestroy( cenRep );
|
|
3184 |
}
|
|
3185 |
}
|
|
3186 |
// -----------------------------------------------------------------------------
|
|
3187 |
// CCalenUnifiedEditor::HideFieldsForEditSingleInstance
|
|
3188 |
// Hides Entry type and Calendar Field for exceptional entry/single
|
|
3189 |
// instance of recurrent entry.
|
|
3190 |
// -----------------------------------------------------------------------------
|
|
3191 |
//
|
|
3192 |
void CCalenUnifiedEditor::HideFieldsForEditSingleInstanceL()
|
|
3193 |
{
|
|
3194 |
TRACE_ENTRY_POINT;
|
|
3195 |
|
|
3196 |
if( !IsCreatingNewEntry() )
|
|
3197 |
{
|
|
3198 |
if((CalenAgendaUtils::IsRepeatingL(*iOriginalCalEntry)
|
|
3199 |
&& iRepeatType == CalCommon::EThisOnly)
|
|
3200 |
|| iOriginalCalEntry->RecurrenceIdL().TimeUtcL() != Time::NullTTime())
|
|
3201 |
{
|
|
3202 |
//Hides Entry Type Filed
|
|
3203 |
CCoeControl* entryTypeControl = ControlOrNull( ECalenEditorEventType );
|
|
3204 |
if( entryTypeControl )
|
|
3205 |
{
|
|
3206 |
DeleteLine(ECalenEditorEventType);
|
|
3207 |
}
|
|
3208 |
//Hides All Day Event Field
|
|
3209 |
CCoeControl* allDayEventControl = ControlOrNull( ECalenEditorAllDayItem );
|
|
3210 |
if( allDayEventControl )
|
|
3211 |
{
|
|
3212 |
DeleteLine(ECalenEditorAllDayItem);
|
|
3213 |
}
|
|
3214 |
//Hides Calendar Field
|
|
3215 |
CCoeControl* calendarControl = ControlOrNull( ECalenEditorDBName );
|
|
3216 |
if( calendarControl )
|
|
3217 |
{
|
|
3218 |
DeleteLine(ECalenEditorDBName);
|
|
3219 |
}
|
|
3220 |
//Hides Repeat Field
|
|
3221 |
CCoeControl* repeatControl = ControlOrNull( ECalenEditorRepeat );
|
|
3222 |
if( repeatControl )
|
|
3223 |
{
|
|
3224 |
DeleteLine(ECalenEditorRepeat);
|
|
3225 |
}
|
|
3226 |
//Hides Repeatuntil Field
|
|
3227 |
CCoeControl* repeatUntilControl = ControlOrNull( ECalenEditorRepeatUntil );
|
|
3228 |
if( repeatUntilControl )
|
|
3229 |
{
|
|
3230 |
DeleteLine(ECalenEditorRepeatUntil);
|
|
3231 |
}
|
|
3232 |
}
|
|
3233 |
}
|
|
3234 |
UpdateFormL();
|
|
3235 |
TRACE_EXIT_POINT;
|
|
3236 |
}
|
|
3237 |
|
|
3238 |
|
|
3239 |
// -----------------------------------------------------------------------------
|
|
3240 |
// CCalenUnifiedEditor::AttachmentNamesL
|
|
3241 |
// Provides all the attachments names
|
|
3242 |
// -----------------------------------------------------------------------------
|
|
3243 |
//
|
|
3244 |
void CCalenUnifiedEditor::GetAttachmentNamesL(RPointerArray<HBufC>& aAttachmentNames)
|
|
3245 |
{
|
|
3246 |
TInt attachCount = iServices->GetAttachmentData()->NumberOfItems();
|
|
3247 |
if( attachCount )
|
|
3248 |
{
|
|
3249 |
RPointerArray<CCalenAttachmentInfo> attachmentInfoList;
|
|
3250 |
CleanupClosePushL( attachmentInfoList );
|
|
3251 |
iServices->GetAttachmentData()->GetAttachmentListL(attachmentInfoList);
|
|
3252 |
for( TInt index =0; index<attachCount; index++ )
|
|
3253 |
{
|
|
3254 |
CCalenAttachmentInfo* attachmentInfo = attachmentInfoList[index];
|
|
3255 |
TParsePtrC fileNameParser( attachmentInfo->FileName() );
|
|
3256 |
HBufC* attachmentName = HBufC::NewL(fileNameParser.NameAndExt().Length());
|
|
3257 |
attachmentName->Des().Copy(fileNameParser.NameAndExt());
|
|
3258 |
aAttachmentNames.Append(attachmentName);
|
|
3259 |
}
|
|
3260 |
CleanupStack::PopAndDestroy( &attachmentInfoList );
|
|
3261 |
}
|
|
3262 |
else
|
|
3263 |
{
|
|
3264 |
Edited().AttachmentNamesL(aAttachmentNames);
|
|
3265 |
}
|
|
3266 |
}
|
|
3267 |
|
|
3268 |
// -----------------------------------------------------------------------------
|
|
3269 |
// CCalenUnifiedEditor::GetServices
|
|
3270 |
// Gets services reference
|
|
3271 |
// -----------------------------------------------------------------------------
|
|
3272 |
//
|
|
3273 |
MCalenServices& CCalenUnifiedEditor::GetServices()
|
|
3274 |
{
|
|
3275 |
return *iServices;
|
|
3276 |
}
|
|
3277 |
|
|
3278 |
// -----------------------------------------------------------------------------
|
|
3279 |
// CMapsIconPicture::CMapsIconPicture
|
|
3280 |
// C++ Constructor
|
|
3281 |
// -----------------------------------------------------------------------------
|
|
3282 |
//
|
|
3283 |
CMapsIconPicture::CMapsIconPicture( MCalenServices& aServices, TRect aRect )
|
|
3284 |
: iServices( aServices ),
|
|
3285 |
iRect( aRect )
|
|
3286 |
{
|
|
3287 |
TRACE_ENTRY_POINT;
|
|
3288 |
TRACE_EXIT_POINT;
|
|
3289 |
}
|
|
3290 |
|
|
3291 |
// -----------------------------------------------------------------------------
|
|
3292 |
// CMapsIconPicture::ExternalizeL
|
|
3293 |
// Pure virtual from CPicture, intentionally empty.
|
|
3294 |
// -----------------------------------------------------------------------------
|
|
3295 |
//
|
|
3296 |
void CMapsIconPicture::ExternalizeL( RWriteStream& /*aStream*/ ) const
|
|
3297 |
{
|
|
3298 |
TRACE_ENTRY_POINT;
|
|
3299 |
TRACE_EXIT_POINT;
|
|
3300 |
}
|
|
3301 |
|
|
3302 |
// -----------------------------------------------------------------------------
|
|
3303 |
// CMapsIconPicture::GetOriginalSizeInTwips
|
|
3304 |
// Convert size to twips
|
|
3305 |
// -----------------------------------------------------------------------------
|
|
3306 |
//
|
|
3307 |
void CMapsIconPicture::GetOriginalSizeInTwips( TSize & /* aSize */ ) const
|
|
3308 |
{
|
|
3309 |
TRACE_ENTRY_POINT;
|
|
3310 |
TRACE_EXIT_POINT;
|
|
3311 |
}
|
|
3312 |
|
|
3313 |
// -----------------------------------------------------------------------------
|
|
3314 |
// CMapsIconPicture::Draw
|
|
3315 |
// Draw funtion to draw the map icon
|
|
3316 |
// -----------------------------------------------------------------------------
|
|
3317 |
//
|
|
3318 |
void CMapsIconPicture::Draw( CGraphicsContext& aGc,
|
|
3319 |
const TPoint& /* aTopLeft */,
|
|
3320 |
const TRect& /* aClipRect */,
|
|
3321 |
MGraphicsDeviceMap* /* aMap */) const
|
|
3322 |
{
|
|
3323 |
TRACE_ENTRY_POINT;
|
|
3324 |
|
|
3325 |
aGc.Reset();
|
|
3326 |
|
|
3327 |
// Create the icon
|
|
3328 |
CGulIcon* icon = NULL;
|
|
3329 |
PIM_TRAPD_HANDLE( icon = iServices.GetIconL( MCalenServices::ECalenMapIcon ) );
|
|
3330 |
|
|
3331 |
TAknLayoutRect icon_layout_rect;
|
|
3332 |
icon_layout_rect.LayoutRect( iRect, AknLayoutScalable_Apps::field_cale_ev_pane_g1( 0 ).LayoutLine() );
|
|
3333 |
TRect area = icon_layout_rect.Rect();
|
|
3334 |
AknIconUtils::SetSize( icon->Bitmap(), area.Size() );
|
|
3335 |
|
|
3336 |
aGc.DrawBitmapMasked( area, icon->Bitmap(), area.Size(), icon->Mask(), ETrue );
|
|
3337 |
delete icon;
|
|
3338 |
|
|
3339 |
TRACE_EXIT_POINT;
|
|
3340 |
}
|
|
3341 |
// End of file
|
|
3342 |
|