66
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: To create and handle, entry description field
|
|
15 |
* of Unifiededitor.
|
|
16 |
*/
|
|
17 |
|
|
18 |
// system includes
|
|
19 |
#include <aknnotewrappers.h>
|
|
20 |
#include <AknQueryDialog.h>
|
|
21 |
#include <calentry.h>
|
|
22 |
#include <eikmenup.h>
|
|
23 |
#include <NpdApi.h>
|
|
24 |
#include <StringLoader.h>
|
|
25 |
#include <CalenDefaultEditorsData.rsg>
|
|
26 |
|
|
27 |
// user includes
|
|
28 |
#include "CalenDescription.h"
|
|
29 |
#include "CalenDescriptionField.h"
|
|
30 |
#include "calenunifiededitor.h"
|
|
31 |
#include "CalenDefaultEditors.hrh"
|
|
32 |
|
|
33 |
// debug
|
|
34 |
#include "calendarui_debug.h"
|
|
35 |
|
|
36 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
37 |
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
// CCalenDescription::CCalenDescription
|
|
40 |
// C++ constructor can NOT contain any code, that might leave.
|
|
41 |
// (other items were commented in a header).
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
CCalenDescription::CCalenDescription( CCalenUnifiedEditor& aEditor )
|
|
45 |
: iEditor( aEditor )
|
|
46 |
{
|
|
47 |
TRACE_ENTRY_POINT;
|
|
48 |
TRACE_EXIT_POINT;
|
|
49 |
}
|
|
50 |
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
// CCalenDescription::ConstructL
|
|
53 |
// Leaving construction.
|
|
54 |
// (other items were commented in a header).
|
|
55 |
// ---------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
void CCalenDescription::ConstructL()
|
|
58 |
{
|
|
59 |
TRACE_ENTRY_POINT;
|
|
60 |
TRACE_EXIT_POINT;
|
|
61 |
}
|
|
62 |
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
// CCalenDescription::NewL
|
|
65 |
// Two-phased constructor.
|
|
66 |
// (other items were commented in a header).
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CCalenDescription* CCalenDescription::NewL( CCalenUnifiedEditor& aEditor )
|
|
70 |
{
|
|
71 |
TRACE_ENTRY_POINT;
|
|
72 |
|
|
73 |
CCalenDescription* self = new( ELeave ) CCalenDescription( aEditor );
|
|
74 |
CleanupStack::PushL( self );
|
|
75 |
self->ConstructL();
|
|
76 |
CleanupStack::Pop();
|
|
77 |
|
|
78 |
TRACE_EXIT_POINT;
|
|
79 |
return self;
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// CCalenDescription::~CCalenDescription
|
|
84 |
// Destructor.
|
|
85 |
// (other items were commented in a header).
|
|
86 |
// -----------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
CCalenDescription::~CCalenDescription()
|
|
89 |
{
|
|
90 |
TRACE_ENTRY_POINT;
|
|
91 |
TRACE_EXIT_POINT;
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CCalenDescription::CreateFieldL
|
|
96 |
// Create a description field.
|
|
97 |
// (other items were commented in a header).
|
|
98 |
// ---------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
SEikControlInfo CCalenDescription::CreateFieldL()
|
|
101 |
{
|
|
102 |
TRACE_ENTRY_POINT;
|
|
103 |
|
|
104 |
SEikControlInfo control = { NULL, 0, 0 };
|
|
105 |
control.iControl = new ( ELeave ) CCalenDescriptionField( *this );
|
|
106 |
control.iTrailerTextId = 0;
|
|
107 |
control.iFlags = 0;
|
|
108 |
|
|
109 |
TRACE_EXIT_POINT;
|
|
110 |
return control;
|
|
111 |
}
|
|
112 |
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
// CCalenDescription::InitDescritpionFieldLayoutL
|
|
115 |
// Updates fields just before the form is shown.
|
|
116 |
// (other items were commented in a header).
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void CCalenDescription::InitDescritpionFieldLayoutL()
|
|
120 |
{
|
|
121 |
TRACE_ENTRY_POINT;
|
|
122 |
|
|
123 |
if ( EntryHasDescription() )
|
|
124 |
{
|
|
125 |
ShowFieldL();
|
|
126 |
}
|
|
127 |
|
|
128 |
TRACE_EXIT_POINT;
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// CCalenDescription::PostLayoutDynInitL
|
|
133 |
// (other items were commented in a header).
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
void CCalenDescription::PostLayoutDynInitL()
|
|
137 |
{
|
|
138 |
TRACE_ENTRY_POINT;
|
|
139 |
TRACE_EXIT_POINT;
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CCalenDescription::DynInitMenuPaneL
|
|
144 |
// Called just before the options menu is shown.
|
|
145 |
// (other items were commented in a header).
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CCalenDescription::DynInitMenuPaneL( TInt aResourceId,
|
|
149 |
CEikMenuPane* aMenuPane )
|
|
150 |
{
|
|
151 |
TRACE_ENTRY_POINT;
|
|
152 |
|
|
153 |
// Handle unified editor menu pane
|
|
154 |
if( aResourceId == R_CALEN_UNIFIED_EDITOR_MENUPANE )
|
|
155 |
{
|
|
156 |
aMenuPane->AddMenuItemsL( R_CALEN_DESCRIPTION_MENU_PANE );
|
|
157 |
|
|
158 |
if( EntryHasDescription() )
|
|
159 |
{
|
|
160 |
// Entry already has Description, delete Add description menu item
|
|
161 |
aMenuPane->DeleteMenuItem( ECalenCmdAddDescription );
|
|
162 |
if ( !IsFieldFocused() )
|
|
163 |
{
|
|
164 |
// Description field not focused,
|
|
165 |
// delete Show/Remove descripion menu item.
|
|
166 |
aMenuPane->DeleteMenuItem( ECalenCmdShowDescription );
|
|
167 |
aMenuPane->DeleteMenuItem( ECalenCmdRemoveDescription );
|
|
168 |
}
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
// Entry don't have description,
|
|
173 |
// delete Show/Remove descripion menu item.
|
|
174 |
aMenuPane->DeleteMenuItem( ECalenCmdShowDescription );
|
|
175 |
aMenuPane->DeleteMenuItem( ECalenCmdRemoveDescription );
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
TRACE_EXIT_POINT;
|
|
180 |
}
|
|
181 |
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
// CCalenDescription::ProcessCommandL
|
|
184 |
// Process commands from the user.
|
|
185 |
// (other items were commented in a header).
|
|
186 |
// ---------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
TBool CCalenDescription::ProcessCommandL( TInt aCommandId )
|
|
189 |
{
|
|
190 |
TRACE_ENTRY_POINT;
|
|
191 |
|
|
192 |
TBool processed = EFalse;
|
|
193 |
switch( aCommandId )
|
|
194 |
{
|
|
195 |
case ECalenCmdAddDescriptionNew:
|
|
196 |
{
|
|
197 |
AddNewL();
|
|
198 |
processed = ETrue;
|
|
199 |
break;
|
|
200 |
}
|
|
201 |
case ECalenCmdAddDescriptionExisting:
|
|
202 |
{
|
|
203 |
AddMemoL();
|
|
204 |
processed = ETrue;
|
|
205 |
break;
|
|
206 |
}
|
|
207 |
case ECalenCmdAddDescription:
|
|
208 |
{
|
|
209 |
if(EntryHasDescription())
|
|
210 |
{
|
|
211 |
ShowL();
|
|
212 |
processed = ETrue;
|
|
213 |
}
|
|
214 |
else
|
|
215 |
{
|
|
216 |
processed = HandleAddDescriptionL();
|
|
217 |
}
|
|
218 |
|
|
219 |
break;
|
|
220 |
}
|
|
221 |
|
|
222 |
case ECalenCmdShowDescription:
|
|
223 |
{
|
|
224 |
|
|
225 |
ShowL();
|
|
226 |
processed = ETrue;
|
|
227 |
break;
|
|
228 |
}
|
|
229 |
case ECalenCmdRemoveDescription:
|
|
230 |
{
|
|
231 |
RemoveL();
|
|
232 |
processed = ETrue;
|
|
233 |
break;
|
|
234 |
}
|
|
235 |
default:
|
|
236 |
break;
|
|
237 |
}
|
|
238 |
|
|
239 |
TRACE_EXIT_POINT;
|
|
240 |
return processed;
|
|
241 |
}
|
|
242 |
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
// CCalenDescription::AddNewL
|
|
245 |
// Add a new description.
|
|
246 |
// (other items were commented in a header).
|
|
247 |
// ---------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
void CCalenDescription::AddNewL()
|
|
250 |
{
|
|
251 |
TRACE_ENTRY_POINT;
|
|
252 |
|
|
253 |
__ASSERT_DEBUG( !EntryHasDescription(), User::Invariant() );
|
|
254 |
|
|
255 |
TInt status = KErrNone;
|
|
256 |
HBufC* desc = ExecTextEditorL( status, KNullDesC );
|
|
257 |
HandleAddL( status, desc );
|
|
258 |
|
|
259 |
TRACE_EXIT_POINT;
|
|
260 |
}
|
|
261 |
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
// CCalenDescription::AddMemoL
|
|
264 |
// Add a memo.
|
|
265 |
// (other items were commented in a header).
|
|
266 |
// ---------------------------------------------------------------------------
|
|
267 |
//
|
|
268 |
void CCalenDescription::AddMemoL()
|
|
269 |
{
|
|
270 |
TRACE_ENTRY_POINT;
|
|
271 |
|
|
272 |
__ASSERT_DEBUG( !EntryHasDescription(), User::Invariant() );
|
|
273 |
|
|
274 |
HBufC* desc = CNotepadApi::FetchMemoL();
|
|
275 |
HandleAddL( KErrNone, desc ); // ownership of description transferred
|
|
276 |
|
|
277 |
TRACE_EXIT_POINT;
|
|
278 |
}
|
|
279 |
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
// CCalenDescription::ShowL
|
|
282 |
// Show the description.
|
|
283 |
// (other items were commented in a header).
|
|
284 |
// ---------------------------------------------------------------------------
|
|
285 |
//
|
|
286 |
void CCalenDescription::ShowL()
|
|
287 |
{
|
|
288 |
TRACE_ENTRY_POINT;
|
|
289 |
|
|
290 |
__ASSERT_DEBUG( EntryHasDescription(), User::Invariant() );
|
|
291 |
__ASSERT_DEBUG( IsFieldVisible(), User::Invariant() );
|
|
292 |
__ASSERT_DEBUG( IsFieldFocused(), User::Invariant() );
|
|
293 |
|
|
294 |
TInt status = KErrNone;
|
|
295 |
|
|
296 |
// Get description text to 'oldDesc'
|
|
297 |
const TDesC& oldDesc = iEditor.Edited().Description();
|
|
298 |
|
|
299 |
|
|
300 |
// Open Description in edit mode
|
|
301 |
HBufC* desc = ExecTextEditorL( status, oldDesc );
|
|
302 |
|
|
303 |
HandleUpdateL( status, desc ); //ownership of description transferred
|
|
304 |
|
|
305 |
TRACE_EXIT_POINT;
|
|
306 |
}
|
|
307 |
|
|
308 |
// ---------------------------------------------------------------------------
|
|
309 |
// CCalenDescription::EditL
|
|
310 |
// Edit the description.
|
|
311 |
// (other items were commented in a header).
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
void CCalenDescription::EditL()
|
|
315 |
{
|
|
316 |
TRACE_ENTRY_POINT;
|
|
317 |
|
|
318 |
__ASSERT_DEBUG( EntryHasDescription(), User::Invariant() );
|
|
319 |
__ASSERT_DEBUG( IsFieldVisible(), User::Invariant() );
|
|
320 |
__ASSERT_DEBUG( IsFieldFocused(), User::Invariant() );
|
|
321 |
|
|
322 |
TInt status = KErrNone;
|
|
323 |
|
|
324 |
// Get description text to 'oldDesc'
|
|
325 |
const TDesC& oldDesc = iEditor.Edited().Description();
|
|
326 |
|
|
327 |
// Edit Descripton 'oldDesc', in notepad viewer
|
|
328 |
HBufC* desc = ExecTextEditorL( status, oldDesc );
|
|
329 |
HandleUpdateL( status, desc ); //ownership of description transferred
|
|
330 |
|
|
331 |
TRACE_EXIT_POINT;
|
|
332 |
}
|
|
333 |
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
// CCalenDescription::RemoveL
|
|
336 |
// Remove the description.
|
|
337 |
// (other items were commented in a header).
|
|
338 |
// ---------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
void CCalenDescription::RemoveL()
|
|
341 |
{
|
|
342 |
TRACE_ENTRY_POINT;
|
|
343 |
|
|
344 |
__ASSERT_DEBUG( EntryHasDescription(), User::Invariant() );
|
|
345 |
__ASSERT_DEBUG( IsFieldVisible(), User::Invariant() );
|
|
346 |
__ASSERT_DEBUG( IsFieldFocused(), User::Invariant() );
|
|
347 |
|
|
348 |
// Ask remove description query.
|
|
349 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
350 |
if( dlg->ExecuteLD(R_CALEN_REMOVE_DESCRIPTION_CONFIRMATION_QUERY) )
|
|
351 |
{
|
|
352 |
// remove description
|
|
353 |
DoRemoveL();
|
|
354 |
}
|
|
355 |
|
|
356 |
TRACE_EXIT_POINT;
|
|
357 |
}
|
|
358 |
|
|
359 |
// ---------------------------------------------------------------------------
|
|
360 |
// CCalenDescription::EntryHasDescription
|
|
361 |
// Returns ETrue if the entry has a desciption, EFalse otherwise.
|
|
362 |
// (other items were commented in a header).
|
|
363 |
// ---------------------------------------------------------------------------
|
|
364 |
//
|
|
365 |
TBool CCalenDescription::EntryHasDescription() const
|
|
366 |
{
|
|
367 |
TRACE_ENTRY_POINT;
|
|
368 |
|
|
369 |
TRACE_EXIT_POINT;
|
|
370 |
return iEditor.Edited().Description().Length() > 0;
|
|
371 |
}
|
|
372 |
|
|
373 |
// ---------------------------------------------------------------------------
|
|
374 |
// CCalenDescription::IsEditedL
|
|
375 |
// Returns ETrue if the description has been edited, EFalse otherwise.
|
|
376 |
// (other items were commented in a header).
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
TBool CCalenDescription::IsEditedL() const
|
|
380 |
{
|
|
381 |
TRACE_ENTRY_POINT;
|
|
382 |
|
|
383 |
TRACE_EXIT_POINT;
|
|
384 |
return iEditor.EditorDataHandler().IsDescriptionEdited();
|
|
385 |
}
|
|
386 |
|
|
387 |
// ---------------------------------------------------------------------------
|
|
388 |
// CCalenDescription::ShowFieldL
|
|
389 |
// Show the description field.
|
|
390 |
// (other items were commented in a header).
|
|
391 |
// ---------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
void CCalenDescription::ShowFieldL()
|
|
394 |
{
|
|
395 |
TRACE_ENTRY_POINT;
|
|
396 |
|
|
397 |
Field()->SetTextL( &( iEditor.Edited().Description() ) );
|
|
398 |
|
|
399 |
TRACE_EXIT_POINT;
|
|
400 |
}
|
|
401 |
|
|
402 |
// ---------------------------------------------------------------------------
|
|
403 |
// CCalenDescription::HideFieldL
|
|
404 |
// Hide the description field.
|
|
405 |
// (other items were commented in a header).
|
|
406 |
// ---------------------------------------------------------------------------
|
|
407 |
//
|
|
408 |
void CCalenDescription::HideFieldL()
|
|
409 |
{
|
|
410 |
TRACE_ENTRY_POINT;
|
|
411 |
|
|
412 |
if( iEditor.ControlOrNull( ECalenEditorDescription ) != NULL)
|
|
413 |
{
|
|
414 |
iEditor.DeleteLine( ECalenEditorDescription );
|
|
415 |
}
|
|
416 |
|
|
417 |
TRACE_EXIT_POINT;
|
|
418 |
}
|
|
419 |
|
|
420 |
// ---------------------------------------------------------------------------
|
|
421 |
// CCalenDescription::Field
|
|
422 |
// Returns the description field.
|
|
423 |
// (other items were commented in a header).
|
|
424 |
// ---------------------------------------------------------------------------
|
|
425 |
//
|
|
426 |
CCalenDescriptionField* CCalenDescription::Field()
|
|
427 |
{
|
|
428 |
TRACE_ENTRY_POINT;
|
|
429 |
|
|
430 |
TRACE_EXIT_POINT;
|
|
431 |
return static_cast< CCalenDescriptionField* >( iEditor.Control( ECalenEditorDescription ) );
|
|
432 |
}
|
|
433 |
|
|
434 |
// ---------------------------------------------------------------------------
|
|
435 |
// CCalenDescription::IsFieldVisible
|
|
436 |
// Returns ETrue if the description field is visible, EFalse otherwise.
|
|
437 |
// (other items were commented in a header).
|
|
438 |
// ---------------------------------------------------------------------------
|
|
439 |
//
|
|
440 |
TBool CCalenDescription::IsFieldVisible()
|
|
441 |
{
|
|
442 |
TRACE_ENTRY_POINT;
|
|
443 |
|
|
444 |
TRACE_EXIT_POINT;
|
|
445 |
return iEditor.ControlOrNull( ECalenEditorDescription ) != NULL;
|
|
446 |
}
|
|
447 |
|
|
448 |
// ---------------------------------------------------------------------------
|
|
449 |
// CCalenDescription::IsFieldFocused
|
|
450 |
// Returns ETrue if the description field is focused, EFalse otherwise.
|
|
451 |
// (other items were commented in a header).
|
|
452 |
// ---------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
TBool CCalenDescription::IsFieldFocused()
|
|
455 |
{
|
|
456 |
TRACE_ENTRY_POINT;
|
|
457 |
|
|
458 |
if( IsFieldVisible() )
|
|
459 |
{
|
|
460 |
TRACE_EXIT_POINT;
|
|
461 |
return Field()->IsFocused();
|
|
462 |
}
|
|
463 |
else
|
|
464 |
{
|
|
465 |
TRACE_EXIT_POINT;
|
|
466 |
return EFalse;
|
|
467 |
}
|
|
468 |
}
|
|
469 |
|
|
470 |
// ---------------------------------------------------------------------------
|
|
471 |
// CCalenDescription::DoRemoveL
|
|
472 |
// Remove the description field.
|
|
473 |
// (other items were commented in a header).
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
void CCalenDescription::DoRemoveL()
|
|
477 |
{
|
|
478 |
TRACE_ENTRY_POINT;
|
|
479 |
|
|
480 |
iEditor.Edited().SetDescriptionL( KNullDesC );
|
|
481 |
const TDesC& emptyString = _L("");
|
|
482 |
iEditor.SetEditorTextL( ECalenEditorDescription, &emptyString );
|
|
483 |
iEditor.UpdateFormL();
|
|
484 |
|
|
485 |
TRACE_EXIT_POINT;
|
|
486 |
}
|
|
487 |
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
// CCalenDescription::HandleAddL
|
|
490 |
// Handles a new description being added. Sets the new description to the entry.
|
|
491 |
// (other items were commented in a header).
|
|
492 |
// ---------------------------------------------------------------------------
|
|
493 |
//
|
|
494 |
void CCalenDescription::HandleAddL( TInt aStatus, HBufC* aDescription )
|
|
495 |
{
|
|
496 |
TRACE_ENTRY_POINT;
|
|
497 |
|
|
498 |
if ( aStatus == KErrNone && aDescription != NULL ) // entry was edited
|
|
499 |
{
|
|
500 |
CleanupStack::PushL( aDescription );
|
|
501 |
iEditor.Edited().SetDescriptionL( *aDescription );
|
|
502 |
CleanupStack::PopAndDestroy( aDescription );
|
|
503 |
|
|
504 |
ShowFieldL();
|
|
505 |
iEditor.UpdateFormL();
|
|
506 |
iEditor.TryChangeFocusToL( ECalenEditorDescription );
|
|
507 |
}
|
|
508 |
else // error
|
|
509 |
{
|
|
510 |
delete aDescription;
|
|
511 |
}
|
|
512 |
|
|
513 |
TRACE_EXIT_POINT;
|
|
514 |
}
|
|
515 |
|
|
516 |
// ---------------------------------------------------------------------------
|
|
517 |
// CCalenDescription::HandleUpdateL
|
|
518 |
// Handle the description being updated.
|
|
519 |
// (other items were commented in a header).
|
|
520 |
// ---------------------------------------------------------------------------
|
|
521 |
//
|
|
522 |
void CCalenDescription::HandleUpdateL( TInt aStatus, HBufC* aDescription )
|
|
523 |
{
|
|
524 |
TRACE_ENTRY_POINT;
|
|
525 |
|
|
526 |
CleanupStack::PushL( aDescription );
|
|
527 |
if ( aStatus == CNotepadApi::ENpdDataDeleted ||
|
|
528 |
aStatus == CNotepadApi::ENpdDataErased ) // entry was erased or deleted
|
|
529 |
{
|
|
530 |
DoRemoveL();
|
|
531 |
if( aStatus == CNotepadApi::ENpdDataErased )
|
|
532 |
{
|
|
533 |
// Info note is only shown when erasing from Notepad
|
|
534 |
HBufC* infoText = StringLoader::LoadLC( R_QTN_CALE_INOTE_DESC_DEL_MEMO );
|
|
535 |
CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
|
|
536 |
note->ExecuteLD( *infoText );
|
|
537 |
CleanupStack::PopAndDestroy( infoText );
|
|
538 |
}
|
|
539 |
}
|
|
540 |
else if ( aStatus == KErrNone && aDescription != NULL )
|
|
541 |
{
|
|
542 |
CleanupStack::Pop( aDescription );
|
|
543 |
iEditor.Edited().SetDescriptionTransferOwnershipL( aDescription );
|
|
544 |
|
|
545 |
Field()->SetTextL( &( iEditor.Edited().Description() ) );
|
|
546 |
iEditor.UpdateFormL();
|
|
547 |
// push NULL to cleanup stack to keep it balanced
|
|
548 |
aDescription = NULL;
|
|
549 |
CleanupStack::PushL( aDescription );
|
|
550 |
}
|
|
551 |
else // error
|
|
552 |
{
|
|
553 |
// unless some error happened, we should never get here
|
|
554 |
// do nothing
|
|
555 |
}
|
|
556 |
CleanupStack::PopAndDestroy( aDescription );
|
|
557 |
|
|
558 |
TRACE_EXIT_POINT;
|
|
559 |
}
|
|
560 |
|
|
561 |
// ---------------------------------------------------------------------------
|
|
562 |
// CCalenDescription::ExecTextEditorL
|
|
563 |
// Open the notepad editor to allow editing of the description.
|
|
564 |
// (other items were commented in a header).
|
|
565 |
// ---------------------------------------------------------------------------
|
|
566 |
//
|
|
567 |
HBufC* CCalenDescription::ExecTextEditorL( TInt& aStatus, const TDesC& aDescription )
|
|
568 |
{
|
|
569 |
TRACE_ENTRY_POINT;
|
|
570 |
|
|
571 |
HBufC* title = StringLoader::LoadLC( R_QTN_CALE_NOTE_TITLE );
|
|
572 |
HBufC* delConf = StringLoader::LoadLC( R_QTN_CALE_Q_DEL_NOTEP_DESC );
|
|
573 |
HBufC* desc = CNotepadApi::ExecTextEditorL( aStatus, aDescription,
|
|
574 |
*title, *delConf );
|
|
575 |
CleanupStack::PopAndDestroy( delConf );
|
|
576 |
CleanupStack::PopAndDestroy( title );
|
|
577 |
|
|
578 |
TRACE_EXIT_POINT;
|
|
579 |
return desc;
|
|
580 |
}
|
|
581 |
|
|
582 |
// ---------------------------------------------------------------------------
|
|
583 |
// CCalenDescription::ExecTextViewerL
|
|
584 |
// Open the notepad viewer to allow viewing of the description.
|
|
585 |
// (other items were commented in a header).
|
|
586 |
// ---------------------------------------------------------------------------
|
|
587 |
//
|
|
588 |
HBufC* CCalenDescription::ExecTextViewerL( TInt& aStatus, const TDesC& aDescription )
|
|
589 |
{
|
|
590 |
TRACE_ENTRY_POINT;
|
|
591 |
|
|
592 |
HBufC* title = StringLoader::LoadLC( R_QTN_CALE_NOTE_TITLE );
|
|
593 |
HBufC* delConf = StringLoader::LoadLC( R_QTN_CALE_Q_DEL_NOTEP_DESC );
|
|
594 |
HBufC* desc = CNotepadApi::ExecTextViewerL( aStatus, aDescription,
|
|
595 |
*title, *delConf );
|
|
596 |
CleanupStack::PopAndDestroy( delConf );
|
|
597 |
CleanupStack::PopAndDestroy( title );
|
|
598 |
|
|
599 |
TRACE_EXIT_POINT;
|
|
600 |
return desc;
|
|
601 |
}
|
|
602 |
|
|
603 |
// ----------------------------------------------------------------------------
|
|
604 |
// CCalenDescription::HandleAddDescriptionL
|
|
605 |
// Handles the command ECalenAddDescription
|
|
606 |
// ----------------------------------------------------------------------------
|
|
607 |
//
|
|
608 |
TBool CCalenDescription::HandleAddDescriptionL()
|
|
609 |
{
|
|
610 |
TRACE_ENTRY_POINT;
|
|
611 |
|
|
612 |
TBool processed = EFalse;
|
|
613 |
TInt selectedIndex(0);
|
|
614 |
CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog(&selectedIndex);
|
|
615 |
dlg->PrepareLC( R_DESCRIPTION_LIST_QUERY );
|
|
616 |
|
|
617 |
if(dlg->RunLD())
|
|
618 |
{
|
|
619 |
switch(selectedIndex)
|
|
620 |
{
|
|
621 |
case 0: //ECalenCmdAddDescriptionNew
|
|
622 |
{
|
|
623 |
// iCheck = 0;
|
|
624 |
AddNewL();
|
|
625 |
processed = ETrue;
|
|
626 |
break;
|
|
627 |
}
|
|
628 |
case 1: //ECalenCmdAddDescriptionExisting
|
|
629 |
{
|
|
630 |
// iCheck = 1;
|
|
631 |
AddMemoL();
|
|
632 |
processed = ETrue;
|
|
633 |
break;
|
|
634 |
}
|
|
635 |
default:
|
|
636 |
break;
|
|
637 |
}
|
|
638 |
}
|
|
639 |
|
|
640 |
TRACE_EXIT_POINT;
|
|
641 |
|
|
642 |
return processed;
|
|
643 |
}
|
|
644 |
// End of File
|