|
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: Implementation of List of Memos/Templates mode. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <bldvariant.hrh> |
|
22 #include <eikmenup.h> |
|
23 #include <eikclbd.h> |
|
24 #include <eikapp.h> |
|
25 #include <aknlists.h> |
|
26 #include <bacntf.h> |
|
27 #include <sendui.h> |
|
28 #include <Sendnorm.rsg> |
|
29 #include <txtglobl.h> |
|
30 #include <AknIconArray.h> |
|
31 #include <StringLoader.h> |
|
32 #include <AknDlgShut.h> |
|
33 #include <AknProgressDialog.h> |
|
34 #include <eikprogi.h> |
|
35 #include <eikimage.h> |
|
36 |
|
37 #include <AvkonIcons.hrh> |
|
38 #include <avkon.mbg> |
|
39 #include <aknlayoutscalable_avkon.cdl.h> |
|
40 #include <gulicon.h> |
|
41 #include <aknconsts.h> |
|
42 #include <hlplch.h> |
|
43 #include <featmgr.h> |
|
44 #include <StringLoader.h> |
|
45 #include <NpdLib.rsg> |
|
46 #include <AiwCommon.hrh> |
|
47 #include <AiwGenericParam.h> |
|
48 #include <CMessageData.h> |
|
49 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
50 #include <vwsdefpartner.h> |
|
51 #endif |
|
52 #include "NpdLib.hrh" |
|
53 #include "NpdListDialog.h" |
|
54 #include "NpdEditorDialog.h" |
|
55 #include "NpdModel_platsec.h" |
|
56 #include "NpdLib.h" |
|
57 #include "NpdListBox.h" |
|
58 |
|
59 #include <csxhelp/nmake.hlp.hrh> |
|
60 #include <csxhelp/mce.hlp.hrh> |
|
61 |
|
62 // Next is for KNotepadPseudoKeyIdForNewNote |
|
63 // |
|
64 #include "NpdApi.h" |
|
65 #include "NpdLibPanic.h" |
|
66 |
|
67 |
|
68 // ============================ MEMBER FUNCTIONS =============================== |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CNotepadListDialog::NewL |
|
72 // Constructor. |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C CNotepadListDialog* CNotepadListDialog::NewL( |
|
76 TInt aResId, // Resource Id of type NOTEPAD_LIST_DIALOG |
|
77 CEikDialog** aSelfPtr ) |
|
78 { |
|
79 CNotepadListDialog* self = new(ELeave) CNotepadListDialog(); |
|
80 self->iSelfPtr = aSelfPtr; |
|
81 CleanupStack::PushL(self); |
|
82 TResourceReader rr; |
|
83 self->iCoeEnv->CreateResourceReaderLC(rr, aResId); // Push rr |
|
84 self->ConstructL( rr ); |
|
85 CleanupStack::PopAndDestroy(); // rr |
|
86 CleanupStack::Pop(); // self |
|
87 return self; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CNotepadListDialog::~CNotepadListDialog |
|
92 // Destructor. |
|
93 // |
|
94 // In destructor of CNotepadEditorDialog, |
|
95 // CNotepadListDialog::iEditorDialog (pointer to the object) will be |
|
96 // NULLed using CNotepadListDialog::EditorDeleted(). |
|
97 // So it is guaranteed that iEditorDialog is NULL iff the object is alive. |
|
98 // |
|
99 // *1* It seems that 'delete iProgressDialog must precceed delete iModel |
|
100 // to avoid a crash when PowerOff while deleting or adding to pinboard. |
|
101 // Because the focus is changed in deleting iProgressDialog |
|
102 // (caused by RemoveFromStack). |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C CNotepadListDialog::~CNotepadListDialog() |
|
106 { |
|
107 delete iIdle; |
|
108 delete iProgressDialog; // *1* |
|
109 delete iEditorDialog; |
|
110 if ( iFlags & ENotepadObserveView ) |
|
111 { |
|
112 iEikonEnv->EikAppUi()->RemoveViewObserver(this); |
|
113 } |
|
114 delete iModel; |
|
115 delete iSendUi; |
|
116 iSavedSelectedKeys.Close(); |
|
117 iSavedKeysAboveCurrent.Close(); |
|
118 delete iEnvironmentChangeNotifier; |
|
119 if ( iServiceHandler ) |
|
120 { |
|
121 |
|
122 delete iServiceHandler; |
|
123 iServiceHandler = NULL; |
|
124 } |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CNotepadListDialog::EditByKeyL |
|
129 // Called from CNotepadAppUi. |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C void CNotepadListDialog::EditByKeyL(const TInt aKey) |
|
133 { |
|
134 __ASSERT_DEBUG( IsNotepad(), |
|
135 Panic(ENotepadLibraryPanicOnlySupportedInNotepad) ); |
|
136 if ( iBaseAppUi == iEikonEnv->EikAppUi() // SendUi is not running |
|
137 /*&& !iBaseAppUi->IsDisplayingDialog()*/ // Dialog is not running |
|
138 && !iModel->IsDeleting() ) |
|
139 { |
|
140 DoEditByKeyL(aKey); |
|
141 } |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CNotepadListDialog::SaveL |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C void CNotepadListDialog::SaveL() |
|
149 { |
|
150 if ( iEditorDialog ) |
|
151 { |
|
152 iEditorDialog->SaveOnExitL(EFalse); |
|
153 } |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CNotepadListDialog::HandleEditorExitL |
|
158 // This function is called from CNotepadEditorDialog. |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CNotepadListDialog::HandleEditorExitL( |
|
162 TInt aStatOfSave, |
|
163 const TInt aKey, |
|
164 const TBool aEagerSync ) |
|
165 { |
|
166 iEditorFlag= EFalse; |
|
167 if ( aKey != KNotepadPseudoKeyIdForNewNote ) |
|
168 { |
|
169 iSavedKey = aKey; |
|
170 } |
|
171 if ( aStatOfSave == CNotepadModel::ENotepadModelRowAdded ) |
|
172 { |
|
173 iFlags |= ENotepadItemAdded; |
|
174 } |
|
175 else |
|
176 { |
|
177 iFlags &= ~ENotepadItemAdded; |
|
178 } |
|
179 if ( aEagerSync ) |
|
180 { |
|
181 if(iClockValueChange) |
|
182 { |
|
183 iModel->SetItemArrayFlags(); |
|
184 iClockValueChange = EFalse; |
|
185 } |
|
186 iModel->SyncL(EFalse); |
|
187 RestoreCurrentAndSelectionsL(); |
|
188 DrawNow(); |
|
189 } |
|
190 if (aStatOfSave == CNotepadModel::ENotepadModelRowDeleted) |
|
191 { |
|
192 iListBox->HandleItemRemovalL(); |
|
193 DrawNow(); |
|
194 } |
|
195 // MSK |
|
196 MiddleSoftKeyL(); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CNotepadListDialog::EditorDeleted |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CNotepadListDialog::EditorDeleted() |
|
204 { |
|
205 iEditorDialog = NULL; |
|
206 iModel->SetNotepadModelObserver(this); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CNotepadListDialog::ConstructL |
|
211 // private second-phase constructor |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CNotepadListDialog::ConstructL( TResourceReader& aReader ) |
|
215 { |
|
216 iNeedSave = EFalse; |
|
217 iSavedKey = KNotepadInvalidKeyId; |
|
218 iSendingEmail = EFalse; |
|
219 CNotepadDialogBase::ConstructL( aReader ); // menubar, dialog |
|
220 TInt modelResId(aReader.ReadInt32()); // LLINK model; |
|
221 iModel = CNotepadModel::NewL( |
|
222 iCoeEnv->FsSession(), modelResId ); |
|
223 iEditorResId = aReader.ReadInt32(); // LLINK editor_dialog |
|
224 TPtrC ptr = aReader.ReadTPtrC(); // LTEXT title |
|
225 if ( ptr.Length() ) |
|
226 { |
|
227 SetTitleL(&ptr); |
|
228 } |
|
229 |
|
230 iSendUi = CSendUi::NewL(); |
|
231 if ( IsNotepad() ) |
|
232 { |
|
233 TCallBack callback(HandleEnvironmentChangedL, this); |
|
234 iEnvironmentChangeNotifier = CEnvironmentChangeNotifier::NewL( |
|
235 EActivePriorityLogonA, callback); |
|
236 iEnvironmentChangeNotifier->Start(); |
|
237 } |
|
238 iEikonEnv->EikAppUi()->AddViewObserverL(this); |
|
239 iFlags |= ENotepadObserveView; |
|
240 iClockValueChange = EFalse; |
|
241 iBaseAppUi = iAvkonAppUi; |
|
242 iModel->SetNotepadModelObserver(this); |
|
243 iBaseLevelOfActiveScheduler = LevelOfActiveScheduler() + 1; |
|
244 // Create instance of CAiwServiceHandler |
|
245 iServiceHandler = CAiwServiceHandler::NewL(); |
|
246 // Attach menu services |
|
247 iServiceHandler->AttachMenuL( R_NOTEPAD_LIST_MENU_SECOND, R_NOTEPAD_APP_INTEREST ); |
|
248 if ( FeatureManager::FeatureSupported( KFeatureIdFfEnablePrintingFramework ) ) |
|
249 { |
|
250 iServiceHandler->AttachMenuL( R_NOTEPAD_LIST_MENU_FIRST, R_PS_AIW_INTEREST ); |
|
251 } |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CNotepadListDialog::StartEditorL |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 void CNotepadListDialog::StartEditorL() |
|
259 { |
|
260 iEditorFlag=ETrue; |
|
261 HideMenu(); |
|
262 __ASSERT_DEBUG(iEditorResId, User::Invariant()); |
|
263 |
|
264 iEditorDialog = CNotepadEditorDialog::NewL(iEditorResId, iModel, this, |
|
265 iSendUi); |
|
266 |
|
267 iEditorDialog->ExecuteLD(); |
|
268 iListBox->ClearSelection(); |
|
269 ClearSavedCurrentAndSelections(); |
|
270 SaveCurrentAndSelectionsL(); |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CNotepadListDialog::OnCmdAddL |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 void CNotepadListDialog::OnCmdAddL() |
|
278 { |
|
279 StartEditorL(); |
|
280 iEditorDialog->SwitchTextL(KNotepadPseudoKeyIdForNewNote); |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CNotepadListDialog::OnCmdOpenL |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CNotepadListDialog::OnCmdOpenL(TInt aIndex) |
|
288 { |
|
289 if ( iModel->MdcaCount() == 0 ) |
|
290 { |
|
291 return; |
|
292 } |
|
293 StartEditorL(); |
|
294 iEditorDialog->SwitchTextL(iModel->Key(aIndex)); |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CNotepadListDialog::ConfirmDeleteL |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 TBool CNotepadListDialog::ConfirmDeleteL(TInt aMemos) |
|
302 { |
|
303 TBool isConfirmed(ETrue); |
|
304 if ( aMemos >= 2 ) |
|
305 { |
|
306 HBufC* prompt = StringLoader::LoadLC( |
|
307 QueryDeleteMultipleResId(), aMemos, iCoeEnv); |
|
308 isConfirmed = ExecuteConfirmationQueryL(prompt); |
|
309 CleanupStack::PopAndDestroy(); // prompt |
|
310 } |
|
311 else |
|
312 { |
|
313 isConfirmed = ExecuteConfirmationQueryL(QueryDeleteSingleResId()); |
|
314 } |
|
315 return isConfirmed; |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CNotepadListDialog::CreateKeyArrayOfSelectionsL |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void CNotepadListDialog::CreateKeyArrayOfSelectionsL() |
|
323 { |
|
324 const CListBoxView::CSelectionIndexArray* selections = |
|
325 iListBox->SelectionIndexes(); |
|
326 const TInt markCount( selections->Count() ); |
|
327 iSavedSelectedKeys.Reset(); |
|
328 for (TInt i(0); i < markCount; i++) |
|
329 { |
|
330 User::LeaveIfError( |
|
331 iSavedSelectedKeys.Append(iModel->Key((*selections)[i])) ); |
|
332 } |
|
333 } |
|
334 |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CNotepadListDialog::OnCmdDeleteL |
|
337 // |
|
338 // IsNotepad IsTemplates |
|
339 // markCount >= 2 **A**(1) **A**(2) |
|
340 // markCount == 1 **C** **A**(3) |
|
341 // markCOunt == 0 **C** **B**(3) |
|
342 // |
|
343 // According to UI specs (Notepad and Message Centre), |
|
344 // in the case of the block **C**, no progress note is needed but |
|
345 // we must show a progress note if markCount>=2 or IsTempates |
|
346 // (block **A** or **B**). |
|
347 // |
|
348 // And there are 3 different labels defined; |
|
349 // (1) "Deleting" |
|
350 // (2) "Deleting template %0N of %1N" |
|
351 // (3) "Deleting template" |
|
352 // Block **B** also create the progress note, but it is different from **A** |
|
353 // in the point that it must create a KeyArray by itself. |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 void CNotepadListDialog::OnCmdDeleteL() |
|
357 { |
|
358 if ( iModel->MdcaCount() == 0 ) // this is posible when clear key |
|
359 { |
|
360 return; |
|
361 } |
|
362 ClearSavedCurrentAndSelections(); |
|
363 SaveCurrentAndSelectionsL(); |
|
364 TInt markCount( iListBox->SelectionIndexes()->Count() ); |
|
365 TInt deleteCount( markCount > 0 ? markCount : 1 ); |
|
366 if ( ConfirmDeleteL( deleteCount ) ) |
|
367 { |
|
368 //be sure that the marks or the items might have gone while confirming |
|
369 // |
|
370 if ( markCount > 0 ? |
|
371 ( deleteCount = iListBox->SelectionIndexes()->Count() ) > 0 : |
|
372 iModel->MdcaCount() > 0 ) |
|
373 { |
|
374 // assert "deleteCount >= 1" |
|
375 if ( deleteCount >= 2 || ( IsTemplates() && markCount ) ) |
|
376 { //**A** |
|
377 // Both Notepad and MCE specs require ProgressDialog |
|
378 // in deleting multiple items. |
|
379 // Only MCE shows ProgressDialog even in deleting one item. |
|
380 // |
|
381 CreateProgressDialogL(deleteCount, |
|
382 deleteCount == 1 ? // when just one template is marked |
|
383 R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATE : |
|
384 ( IsTemplates() ? // when two or more templates are marked |
|
385 R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATES : |
|
386 0 )); // default label for Notepad |
|
387 iModel->DeleteByKeysL(iSavedSelectedKeys); // start CIdle |
|
388 } |
|
389 else if ( IsTemplates() ) // MCE, delete a focused item |
|
390 { //**B** |
|
391 // MCE spec requires ProgressDialog even in deleting one item |
|
392 // |
|
393 RArray<TInt> keys(1); |
|
394 CleanupClosePushL(keys); |
|
395 User::LeaveIfError(keys.Append(iSavedKey)); |
|
396 CreateProgressDialogL( deleteCount, |
|
397 R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATE ); |
|
398 iModel->DeleteByKeysL(keys); // start CIdle |
|
399 CleanupStack::PopAndDestroy();// keys |
|
400 } |
|
401 else |
|
402 { //**C** |
|
403 // Notepad spec doesn't require ProgressDialog |
|
404 // in deleting a single item |
|
405 // |
|
406 iModel->DeleteL( markCount == 0 ? iSavedKey : |
|
407 iSavedSelectedKeys[0] ); |
|
408 } |
|
409 } |
|
410 } |
|
411 iModel->SyncL(EFalse); // sync might be delayed while confirming |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CNotepadListDialog::OnCmdSendL |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 void CNotepadListDialog::OnCmdSendL(TInt aCommandId) |
|
419 { |
|
420 if ( iModel->MdcaCount() == 0 ) |
|
421 { |
|
422 return; |
|
423 } |
|
424 if ( iListBox->SelectionIndexes()->Count() > 0 ) |
|
425 { |
|
426 ClearSavedCurrentAndSelections(); |
|
427 SaveCurrentAndSelectionsL(); |
|
428 TUid serviceUid = SendByKeysL(*iSendUi, aCommandId, *iModel, iSavedSelectedKeys); |
|
429 iModel->SyncL(EFalse); // sync might be delayed while SendAsL. |
|
430 RestoreCurrentAndSelectionsL(); |
|
431 //RestoreCurrent(); |
|
432 TUid EmailUid = {0x10001028}; |
|
433 if ( serviceUid == EmailUid ) |
|
434 { |
|
435 iSendingEmail = ETrue; |
|
436 } |
|
437 |
|
438 } |
|
439 else |
|
440 { |
|
441 HBufC* text = iModel->ContentL(iListBox->CurrentItemIndex()); |
|
442 CleanupStack::PushL(text); |
|
443 iSavedKey = iModel->Key(iListBox->CurrentItemIndex()); |
|
444 SendAsL( *iSendUi, aCommandId, EFalse, text ); |
|
445 CleanupStack::PopAndDestroy(); // text |
|
446 iModel->SyncL(EFalse); // sync might be delayed while SendAsL. |
|
447 RestoreCurrentAndSelectionsL(); |
|
448 } |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // CNotepadListDialog::CreateProgressDialogL |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 void CNotepadListDialog::CreateProgressDialogL( |
|
456 const TInt aCount, |
|
457 const TInt aLabelResId ) |
|
458 { |
|
459 __ASSERT_DEBUG( aCount >= 1, |
|
460 Panic(ENotepadLibraryPanicInvalidFinalValueOfProgressNote) ); |
|
461 delete iProgressDialog; |
|
462 iProgressDialog = NULL; |
|
463 iProgressDialog = new(ELeave) CNotepadProgressDialog( |
|
464 REINTERPRET_CAST( CEikDialog**, &iProgressDialog ), EFalse); |
|
465 |
|
466 iProgressDialog->SetMopParent(this); |
|
467 |
|
468 iProgressDialog->PrepareLC(R_NOTEPAD_DELETE_PROGRESS_NOTE); |
|
469 |
|
470 iProgressDialog->PrepareL(aCount, aLabelResId); |
|
471 iProgressDialog->ProgressInfo()->SetFinalValue( |
|
472 aLabelResId == 0 ? |
|
473 aCount * 2 // In Notepad deleting a item is done by 2 steps |
|
474 : aCount ); |
|
475 iProgressDialog->SetCallback(this); |
|
476 iProgressDialog->RunLD(); |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CNotepadListDialog::DoEditByKeyL |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 void CNotepadListDialog::DoEditByKeyL(const TInt aKey) |
|
484 { |
|
485 iModel->SyncL(EFalse); |
|
486 if ( iEditorDialog ) |
|
487 { |
|
488 iEditorDialog->EditByKeyL(aKey, *iBaseAppUi); |
|
489 } |
|
490 else if ( aKey != KNotepadPseudoKeyIdForNewNote |
|
491 && iModel->SeekKey(aKey) == 0 ) |
|
492 { |
|
493 // Open the memo with the given key (aKey) |
|
494 OnCmdOpenL( iModel->IndexOf(aKey) ); |
|
495 } |
|
496 else |
|
497 { |
|
498 // Launch empty editor (pinned number -1 means "Write a Note") |
|
499 OnCmdAddL(); |
|
500 } |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CNotepadListDialog::HandleEnvironmentChangedL |
|
505 // private static function. |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 TInt CNotepadListDialog::HandleEnvironmentChangedL( TAny* aThisPtr ) |
|
509 { |
|
510 return STATIC_CAST(CNotepadListDialog*, |
|
511 aThisPtr)->DoHandleEnvironmentChangedL(); |
|
512 } |
|
513 |
|
514 // ----------------------------------------------------------------------------- |
|
515 // CNotepadListDialog::DoHandleEnvironmentChangedL |
|
516 // |
|
517 // Just after first time iCrossoverNotifier->Start() is called, |
|
518 // HandleDateChanged seems to be called. |
|
519 // To avoid calling ForceListSync at the first callback, |
|
520 // we use a flag ENotepadEverEnvironmentChanged. |
|
521 // When this function is called at first, the flag is off and so |
|
522 // ForceListSync is blocked by condition |
|
523 // ( iFlags & ENotepadEverEnvironmentChanged ) |
|
524 // and then the flag is set to be on. |
|
525 // |
|
526 // Even if this function may LEAVE, the notification will not be |
|
527 // cancelled (ie. the callback is made on further EnvironmentChange. |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 TInt CNotepadListDialog::DoHandleEnvironmentChangedL() |
|
531 { |
|
532 iClockValueChange = ((iEnvironmentChangeNotifier->Change() |
|
533 & ( EChangesMidnightCrossover | EChangesLocale | EChangesSystemTime )) != 0); |
|
534 |
|
535 if ( ( iFlags & ENotepadEverEnvironmentChanged ) && iClockValueChange) |
|
536 { |
|
537 iModel->HandleDateChangedL((iFlags & ENotepadIsBackground)); |
|
538 } |
|
539 iFlags |= ENotepadEverEnvironmentChanged; |
|
540 |
|
541 return TRUE; // callback should be called again. |
|
542 } |
|
543 |
|
544 // ----------------------------------------------------------------------------- |
|
545 // CNotepadListDialog::SaveCurrentAndSelectionsL |
|
546 // does nothing if already saved. |
|
547 // ----------------------------------------------------------------------------- |
|
548 // |
|
549 void CNotepadListDialog::SaveCurrentAndSelectionsL() |
|
550 { |
|
551 if ( iSavedKey != KNotepadInvalidKeyId ) // ie. already saved |
|
552 { |
|
553 return; |
|
554 } |
|
555 if ( iModel->MdcaCount() == 0 ) // empty |
|
556 { |
|
557 ClearSavedCurrentAndSelections(); |
|
558 } |
|
559 else |
|
560 { |
|
561 // save current |
|
562 // |
|
563 TInt currentIndex( iListBox->CurrentItemIndex() ); |
|
564 iSavedKey = iModel->Key(currentIndex); |
|
565 iSavedKeysAboveCurrent.Reset(); |
|
566 for ( TInt i(0); i < currentIndex; i++ ) |
|
567 { |
|
568 User::LeaveIfError( |
|
569 iSavedKeysAboveCurrent.Append(iModel->Key(i))); |
|
570 } |
|
571 // save selections |
|
572 // |
|
573 CreateKeyArrayOfSelectionsL(); |
|
574 } |
|
575 } |
|
576 |
|
577 // ----------------------------------------------------------------------------- |
|
578 // CNotepadListDialog::RestoreCurrentAndSelectionsL |
|
579 // |
|
580 // The case **1** is posible, eg. in following case; |
|
581 // 1. Launch Notepad and suspend it by Application key in empty List mode, |
|
582 // 2. Save a certain file as a memo using NpdTest.app, |
|
583 // 3. Launch Pinboard and select "Write a note", |
|
584 // then crash (if **1** were not done). |
|
585 // |
|
586 // Why this function TRAP RestoreSelectionsL? |
|
587 // 1. We must do SetDisableRedraw(EFalse) even if LEAVE, |
|
588 // 2. We must do ClearSavedCurrentAndSelections even if LEAVE. |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 void CNotepadListDialog::RestoreCurrentAndSelectionsL() |
|
592 { |
|
593 const TBool isEmpty( iModel->MdcaCount() == 0 ); |
|
594 if ( !isEmpty && iListBox->CurrentItemIndex() < 0 ) // **1** |
|
595 { |
|
596 iListBox->SetCurrentItemIndex(0); |
|
597 } |
|
598 if ( iSavedKey != KNotepadInvalidKeyId ) // ie. has saved |
|
599 { |
|
600 TInt err(KErrNone); |
|
601 if ( !isEmpty ) // not empty |
|
602 { |
|
603 TBool redrawDisabledByThisFunction(EFalse); |
|
604 if ( !iListBox->View()->RedrawDisabled() ) |
|
605 { |
|
606 iListBox->View()->SetDisableRedraw(ETrue); |
|
607 redrawDisabledByThisFunction = ETrue; |
|
608 } |
|
609 RestoreCurrent(); |
|
610 AdjustTopItemIfNeed(); |
|
611 |
|
612 TRAP(err, RestoreSelectionsL();); // LEAVE should be postponed |
|
613 if ( redrawDisabledByThisFunction ) |
|
614 { |
|
615 iListBox->View()->SetDisableRedraw(EFalse); |
|
616 } |
|
617 } |
|
618 ClearSavedCurrentAndSelections(); |
|
619 if (iNeedSave) |
|
620 { |
|
621 SaveCurrentAndSelectionsL(); |
|
622 iNeedSave = EFalse; |
|
623 } |
|
624 User::LeaveIfError(err); |
|
625 /* iListBox->ScrollBarFrame()->MoveVertThumbTo( |
|
626 iListBox->CurrentItemIndex());*/ |
|
627 } |
|
628 } |
|
629 |
|
630 // ----------------------------------------------------------------------------- |
|
631 // CNotepadListDialog::RestoreCurrent |
|
632 // ----------------------------------------------------------------------------- |
|
633 // |
|
634 void CNotepadListDialog::RestoreCurrent() |
|
635 { |
|
636 __ASSERT_DEBUG( iModel->MdcaCount() > 0, |
|
637 Panic(ENotepadLibraryPanicNoItem) ); |
|
638 TInt resultIndex( iModel->IndexOf( iSavedKey ) ); |
|
639 if ( resultIndex == KNotepadModelInvalidIndex ) // not found |
|
640 { |
|
641 const TInt savedIndex( iSavedKeysAboveCurrent.Count() ); |
|
642 if ( savedIndex == 0 ) |
|
643 { |
|
644 resultIndex = 0; |
|
645 } |
|
646 else |
|
647 { |
|
648 for ( TInt i(savedIndex - 1); i >= 0; --i ) |
|
649 { |
|
650 TInt index( iModel->IndexOf(iSavedKeysAboveCurrent[i]) ); |
|
651 if ( index == KNotepadModelInvalidIndex || |
|
652 index >= savedIndex ) |
|
653 { |
|
654 //the key no longer exists above current |
|
655 iSavedKeysAboveCurrent.Remove(i); |
|
656 } |
|
657 } |
|
658 resultIndex = iSavedKeysAboveCurrent.Count(); |
|
659 if ( resultIndex >= iModel->MdcaCount() ) |
|
660 { |
|
661 resultIndex = iModel->MdcaCount() - 1; // assert "count>0" |
|
662 } |
|
663 } |
|
664 } |
|
665 iListBox->View()->CalcBottomItemIndex(); // to avoid crash in next line |
|
666 iListBox->SetCurrentItemIndex( resultIndex ); |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CNotepadListDialog::RestoreSelectionsL |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CNotepadListDialog::RestoreSelectionsL() |
|
674 { |
|
675 iListBox->ClearSelection(); |
|
676 for ( TInt i(0); i < iSavedSelectedKeys.Count() ; i++ ) |
|
677 { |
|
678 TInt selectedIndex( iModel->IndexOf(iSavedSelectedKeys[i]) ); |
|
679 if ( selectedIndex != KNotepadModelInvalidIndex ) // found |
|
680 { |
|
681 iListBox->View()->SelectItemL(selectedIndex); |
|
682 } |
|
683 } |
|
684 } |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // CNotepadListDialog::ClearSavedCurrentAndSelections |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 void CNotepadListDialog::ClearSavedCurrentAndSelections() |
|
691 { |
|
692 iSavedKey = KNotepadPseudoKeyIdForNewNote; |
|
693 iSavedKeysAboveCurrent.Reset(); |
|
694 iSavedKeysAboveCurrent.Compress(); |
|
695 iSavedSelectedKeys.Reset(); |
|
696 iSavedSelectedKeys.Compress(); |
|
697 } |
|
698 |
|
699 // ----------------------------------------------------------------------------- |
|
700 // CNotepadListDialog::AdjustTopItemIfNeed |
|
701 // ----------------------------------------------------------------------------- |
|
702 // |
|
703 void CNotepadListDialog::AdjustTopItemIfNeed() |
|
704 { |
|
705 __ASSERT_DEBUG( iModel->MdcaCount() > 0, |
|
706 Panic(ENotepadLibraryPanicNoItem) ); |
|
707 if ( iFlags & ENotepadItemAdded ) |
|
708 { |
|
709 iFlags &= ~ENotepadItemAdded; |
|
710 const TInt count( iModel->MdcaCount() ); |
|
711 const TInt index( iListBox->CurrentItemIndex() ); |
|
712 const TInt lines( iListBox->View()->NumberOfItemsThatFitInRect( |
|
713 iListBox->View()->ViewRect() ) ); |
|
714 iListBox->View()->SetTopItemIndex( |
|
715 (count - lines) >= index ? index : |
|
716 ( count > lines ? count - lines : 0 ) ); |
|
717 } |
|
718 } |
|
719 |
|
720 // ----------------------------------------------------------------------------- |
|
721 // CNotepadListDialog::AvoidSyncing |
|
722 // ----------------------------------------------------------------------------- |
|
723 // |
|
724 TBool CNotepadListDialog::AvoidSyncing() const |
|
725 { |
|
726 return (((iEditorDialog != NULL) && iEditorDialog->IsFocused()) || iModel->IsDeleting() |
|
727 || (LevelOfActiveScheduler() != iBaseLevelOfActiveScheduler) |
|
728 || ((iFlags & ENotepadIsBackground) && !iClockValueChange) |
|
729 || (iBaseAppUi != iEikonEnv->EikAppUi())); |
|
730 } |
|
731 |
|
732 // ----------------------------------------------------------------------------- |
|
733 // CNotepadListDialog::DoHandleViewEventL |
|
734 // |
|
735 // When launching Notepad application, |
|
736 // the event TVwsViewEvent::EVwsActivateView occurs |
|
737 // but we have nothing to do at that time |
|
738 // (because all operations are for resuming). |
|
739 // In order to avoid doing such needless operations, |
|
740 // we use the flag ENotepadEverViewDeactivated which denotes |
|
741 // whether the view has deactivated. |
|
742 // This flag is set first time TVwsViewEvent::EVwsDeactivateView, |
|
743 // and will never be cleared in this object's lifetime. |
|
744 // ----------------------------------------------------------------------------- |
|
745 // |
|
746 void CNotepadListDialog::DoHandleViewEventL(const TVwsViewEvent& aEvent) |
|
747 { |
|
748 TLocale local; |
|
749 switch ( aEvent.iEventType ) |
|
750 { |
|
751 case TVwsViewEvent::EVwsActivateView: |
|
752 iFlags &= ~ENotepadIsBackground; |
|
753 if ( iFlags & ENotepadEverViewDeactivated ) |
|
754 { |
|
755 iCurrentTimeFormat = local.TimeFormat(); |
|
756 if ( !AvoidSyncing()||( iCurrentTimeFormat != iPreTimeFormat )||(iModel->ItemArrayFlags())& CNotepadModel::ENotepadRequireDbViewUpdate ) |
|
757 { |
|
758 iModel->SetItemArrayFlags(); |
|
759 iModel->SyncL(EFalse); |
|
760 iNeedSave = ETrue; |
|
761 if (iEditorFlag) |
|
762 { |
|
763 RestoreCurrentAndSelectionsL(); |
|
764 } |
|
765 if( iCurrentTimeFormat!= iPreTimeFormat ) |
|
766 { |
|
767 break; |
|
768 } |
|
769 iListBox->DrawNow(); |
|
770 } |
|
771 } |
|
772 break; |
|
773 case TVwsViewEvent::EVwsDeactivateView: |
|
774 iPreTimeFormat = local.TimeFormat(); |
|
775 iFlags |= ENotepadIsBackground; |
|
776 iFlags |= ENotepadEverViewDeactivated; |
|
777 if ( !iEditorDialog |
|
778 && LevelOfActiveScheduler() == iBaseLevelOfActiveScheduler |
|
779 && iBaseAppUi == iEikonEnv->EikAppUi() //SendUi isn't running |
|
780 && !iModel->IsDeleting() ) |
|
781 { |
|
782 ClearSavedCurrentAndSelections(); |
|
783 if ( !iSendingEmail ) |
|
784 { |
|
785 SaveCurrentAndSelectionsL(); |
|
786 } |
|
787 iSendingEmail = EFalse; |
|
788 } |
|
789 break; |
|
790 default: |
|
791 break; |
|
792 } |
|
793 } |
|
794 |
|
795 // ----------------------------------------------------------------------------- |
|
796 // CNotepadListDialog::HandleNotepadModelEventL |
|
797 // ----------------------------------------------------------------------------- |
|
798 // |
|
799 void CNotepadListDialog::HandleNotepadModelEventL( |
|
800 TEvent aEvent, |
|
801 TInt aParam ) |
|
802 { |
|
803 switch ( aEvent ) |
|
804 { |
|
805 case EDatabaseChanged: |
|
806 if ( !AvoidSyncing() ) |
|
807 { |
|
808 if(iClockValueChange) |
|
809 { |
|
810 iModel->SetItemArrayFlags(); |
|
811 iClockValueChange = EFalse; |
|
812 } |
|
813 iModel->SyncL(EFalse); |
|
814 } |
|
815 break; |
|
816 case EAbortDeletion: |
|
817 // no need for DialogDismissedL, so no need for ProcessFinishedL |
|
818 delete iProgressDialog; |
|
819 iProgressDialog = NULL; |
|
820 break; |
|
821 case ECompleteDeletion: |
|
822 if ( iProgressDialog ) |
|
823 { |
|
824 iProgressDialog->ProcessFinishedL(); |
|
825 } |
|
826 break; |
|
827 case EProgressDeletion: |
|
828 if ( iProgressDialog && aParam > 0 ) |
|
829 { |
|
830 iProgressDialog->IncrementL(aParam); |
|
831 } |
|
832 break; |
|
833 case EStartItemArrayChange: |
|
834 SaveCurrentAndSelectionsL(); |
|
835 break; |
|
836 case EAbortItemArrayChange: |
|
837 iListBox->View()->SetDisableRedraw(EFalse); |
|
838 iListBox->Reset(); |
|
839 iListBox->DrawDeferred(); |
|
840 //MSK |
|
841 MiddleSoftKeyL(); |
|
842 break; |
|
843 case EProgressItemArrayChange: |
|
844 // skip RestoreCurrentAndSelectionsL |
|
845 iListBox->View()->SetDisableRedraw(EFalse); |
|
846 iListBox->DrawDeferred(); |
|
847 break; |
|
848 case ECompleteItemArrayChange: |
|
849 iListBox->HandleItemRemovalL(); |
|
850 iNeedSave = ETrue; |
|
851 RestoreCurrentAndSelectionsL(); |
|
852 iListBox->View()->SetDisableRedraw(EFalse); |
|
853 iListBox->DrawNow(); |
|
854 //MSK |
|
855 MiddleSoftKeyL(); |
|
856 break; |
|
857 default: |
|
858 break; |
|
859 } |
|
860 } |
|
861 |
|
862 // ----------------------------------------------------------------------------- |
|
863 // CNotepadListDialog::DynInitMenuPaneL |
|
864 // from MEikMenuObserver |
|
865 // ----------------------------------------------------------------------------- |
|
866 // |
|
867 void CNotepadListDialog::DynInitMenuPaneL( |
|
868 TInt aResourceId, |
|
869 CEikMenuPane* aMenuPane ) |
|
870 { |
|
871 __ASSERT_DEBUG( aResourceId > 0, |
|
872 Panic(ENotepadLibraryPanicNoMenuResource) ); |
|
873 __ASSERT_DEBUG( aMenuPane, Panic(ENotepadLibraryPanicNullMenuPane) ); |
|
874 __ASSERT_DEBUG( iListBox, Panic(ENotepadLibraryPanicNullListControl) ); |
|
875 __ASSERT_DEBUG( iModel, Panic(ENotepadLibraryPanicNoModel) ); |
|
876 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
|
877 { |
|
878 return; |
|
879 } |
|
880 iModel->SyncL(EFalse); |
|
881 CNotepadDialogBase::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
882 const TInt memoCount( iModel->MdcaCount() ); |
|
883 const TInt markCount( iListBox->SelectionIndexes()->Count() ); |
|
884 TInt index; |
|
885 switch ( aResourceId ) |
|
886 { |
|
887 case R_SENDUI_MENU: |
|
888 index = 2; |
|
889 iSendUi->AddSendMenuItemL(*aMenuPane, index, ENotepadCmdSend ); |
|
890 break; |
|
891 case R_NOTEPAD_LIST_MENU_SECOND: |
|
892 if( !(iFlags & ENotepadMenuByOkKey) || (memoCount && !markCount)) |
|
893 { |
|
894 iServiceHandler->InitializeMenuPaneL( *aMenuPane, aResourceId, ECmdLast, iServiceHandler->InParamListL() ); |
|
895 } |
|
896 if ( iFlags & ENotepadMenuByOkKey ) |
|
897 { |
|
898 if ( !memoCount || markCount ) |
|
899 { |
|
900 aMenuPane->DeleteMenuItem(ECmdAiwPlaceholder); |
|
901 } |
|
902 } |
|
903 // go through into next case |
|
904 case R_NOTEPAD_TEMPLATE_LIST_MENU_SECOND: |
|
905 { |
|
906 if(!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
907 { |
|
908 aMenuPane->DeleteMenuItem(EAknCmdHelp); |
|
909 } |
|
910 if ( iFlags & ENotepadMenuByOkKey ) |
|
911 { |
|
912 if ( !memoCount || markCount ) |
|
913 { |
|
914 if( markCount ) |
|
915 aMenuPane->DeleteMenuItem(ENotepadCmdAdd); |
|
916 } |
|
917 if(FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
918 { |
|
919 aMenuPane->DeleteMenuItem(EAknCmdHelp); |
|
920 } |
|
921 aMenuPane->DeleteMenuItem(EAknCmdExit); |
|
922 } |
|
923 } |
|
924 break; |
|
925 case R_NOTEPAD_LIST_MENU_FIRST: |
|
926 case R_NOTEPAD_TEMPLATE_LIST_MENU_FIRST: |
|
927 { |
|
928 if ( IsNotepad() ) |
|
929 { |
|
930 if ( FeatureManager::FeatureSupported( KFeatureIdFfEnablePrintingFramework ) ) |
|
931 { |
|
932 // Initiliaze menu |
|
933 if ( memoCount ) |
|
934 { |
|
935 iServiceHandler->InitializeMenuPaneL( *aMenuPane, |
|
936 aResourceId, |
|
937 ENotepadCmdPrint, |
|
938 iServiceHandler->InParamListL() |
|
939 ); |
|
940 } |
|
941 else |
|
942 // If listbox is empty, delete Print AIW menu item. |
|
943 { |
|
944 aMenuPane->DeleteMenuItem( ENotepadCmdPrint ); |
|
945 } |
|
946 } // KFeatureIdFfEnablePrintingFramework |
|
947 else |
|
948 { |
|
949 aMenuPane->DeleteMenuItem( ENotepadCmdPrint ); |
|
950 } |
|
951 } |
|
952 TInt currIndex = iListBox->CurrentItemIndex(); |
|
953 TKeyArrayFix itemKey(0,ECmpTUint); |
|
954 TInt ignore; |
|
955 TInt itemMarked = iListBox->SelectionIndexes()->Find( currIndex, itemKey, ignore ); |
|
956 if ( memoCount > 0 && |
|
957 ( markCount == 0 || IsNotepad() ) ) |
|
958 { |
|
959 // this must preceed DeleteMenuItem(ENotepadCmdOpen) |
|
960 InsertSendMenuItemAfterL( *iSendUi, *aMenuPane, |
|
961 ENotepadCmdOpen ); |
|
962 } |
|
963 if ( memoCount == 0 ) |
|
964 { |
|
965 aMenuPane->DeleteMenuItem(ENotepadCmdDelete); |
|
966 } |
|
967 if ( (memoCount == 0) || ( markCount >= 1 ) ) |
|
968 { |
|
969 // this must after InsertSendMenuItemAfterL |
|
970 aMenuPane->DeleteMenuItem(ENotepadCmdOpen); |
|
971 } |
|
972 } |
|
973 break; |
|
974 default: |
|
975 AknSelectionService::HandleMarkableListDynInitMenuPane( |
|
976 aResourceId, aMenuPane, iListBox); |
|
977 break; |
|
978 } |
|
979 } |
|
980 |
|
981 // ----------------------------------------------------------------------------- |
|
982 // CNotepadListDialog::DynInitMenuBarL |
|
983 // from MEikMenuObserver |
|
984 // ----------------------------------------------------------------------------- |
|
985 // |
|
986 void CNotepadListDialog::DynInitMenuBarL( |
|
987 TInt aResourceId, |
|
988 CEikMenuBar* aMenuBar ) |
|
989 |
|
990 { |
|
991 |
|
992 __ASSERT_DEBUG( aResourceId > 0, |
|
993 Panic(ENotepadLibraryPanicNoMenuResource) ); |
|
994 __ASSERT_DEBUG( aMenuBar, Panic(ENotepadLibraryPanicNoMenuResource) ); |
|
995 |
|
996 if (iMskFlag) |
|
997 { |
|
998 |
|
999 aMenuBar->SetMenuType(CEikMenuBar::EMenuContext); |
|
1000 iMskFlag= EFalse; |
|
1001 } |
|
1002 else |
|
1003 { |
|
1004 aMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); |
|
1005 } |
|
1006 |
|
1007 |
|
1008 } |
|
1009 |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // CNotepadListDialog::ProcessCommandL |
|
1012 // from MEikCommandObserver |
|
1013 // ----------------------------------------------------------------------------- |
|
1014 // |
|
1015 void CNotepadListDialog::ProcessCommandL(TInt aCommandId) |
|
1016 { |
|
1017 HideMenu(); |
|
1018 switch ( aCommandId ) |
|
1019 { |
|
1020 case ENotepadCmdOpen: // Open memo |
|
1021 OnCmdOpenL(iListBox->CurrentItemIndex()); |
|
1022 break; |
|
1023 case ENotepadCmdAdd: |
|
1024 OnCmdAddL(); |
|
1025 break; |
|
1026 case ENotepadCmdDelete: |
|
1027 OnCmdDeleteL(); |
|
1028 break; |
|
1029 case ENotepadCmdSend: |
|
1030 OnCmdSendL(aCommandId); |
|
1031 break; |
|
1032 default: |
|
1033 { |
|
1034 const TInt aiwServiceCmd( iServiceHandler ? iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) : 0 ); |
|
1035 if ( aiwServiceCmd == KAiwCmdPrint ) |
|
1036 { |
|
1037 CAiwGenericParamList& inParams = iServiceHandler->InParamListL(); |
|
1038 |
|
1039 // Note index |
|
1040 TAiwGenericParam noteParam( EGenericParamNoteItem ); |
|
1041 const TInt32 noteKey = iModel->Key( iListBox->CurrentItemIndex() ); |
|
1042 noteParam.Value().Set( noteKey ); |
|
1043 inParams.AppendL( noteParam ); |
|
1044 |
|
1045 // Application uid |
|
1046 const TUid uid( KUidNotepad ); // Notepad Uid3 |
|
1047 TAiwGenericParam uidParam( EGenericParamApplication ); |
|
1048 uidParam.Value().Set( uid ); |
|
1049 inParams.AppendL( uidParam ); |
|
1050 |
|
1051 // Execute service command with given parameters |
|
1052 iServiceHandler->ExecuteMenuCmdL( aCommandId, |
|
1053 inParams, |
|
1054 iServiceHandler->OutParamListL(), |
|
1055 0, |
|
1056 this |
|
1057 ); |
|
1058 break; |
|
1059 } |
|
1060 |
|
1061 AknSelectionService::HandleMarkableListProcessCommandL( |
|
1062 aCommandId, iListBox); |
|
1063 CNotepadDialogBase::ProcessCommandL(aCommandId); |
|
1064 TInt appid = EGenericParamContactItem; |
|
1065 CAiwGenericParamList* list = AiwSyncParamListLC( appid ); |
|
1066 iServiceHandler->ExecuteMenuCmdL( aCommandId, *list, iServiceHandler->OutParamListL() ); |
|
1067 CleanupStack::PopAndDestroy(list); |
|
1068 //MSK |
|
1069 MiddleSoftKeyL(); |
|
1070 break; |
|
1071 } |
|
1072 } |
|
1073 } |
|
1074 |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // CNotepadListDialog::AiwSyncParamListLC |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // |
|
1079 CAiwGenericParamList* CNotepadListDialog::AiwSyncParamListLC(TInt /*aApplicationId*/) |
|
1080 { |
|
1081 TAiwVariant variant; |
|
1082 variant.Set(KNullDesC); |
|
1083 TAiwGenericParam param(EGenericParamNoteItem, variant); |
|
1084 CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); |
|
1085 list->AppendL(param); |
|
1086 return list; |
|
1087 } |
|
1088 |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 // CNotepadListDialog::HandleViewEventL |
|
1091 // from MCoeViewObserver |
|
1092 // It seems that observing a view is canceled once this function leave, |
|
1093 // So we decide to avoid leaving in this function. |
|
1094 // ----------------------------------------------------------------------------- |
|
1095 // |
|
1096 void CNotepadListDialog::HandleViewEventL(const TVwsViewEvent& aEvent) |
|
1097 { |
|
1098 if ( aEvent.iViewOneId.iAppUid.iUid != aEvent.iViewTwoId.iAppUid.iUid ) |
|
1099 { |
|
1100 TRAPD(err, DoHandleViewEventL(aEvent); ); |
|
1101 if ( err != KErrNone ) |
|
1102 { |
|
1103 iCoeEnv->HandleError(err); |
|
1104 } |
|
1105 } |
|
1106 } |
|
1107 |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 // CNotepadListDialog::DialogDismissedL |
|
1110 // From MProgressDialogCallback. |
|
1111 // |
|
1112 // MProgressDialogCallback::DialogDismissedL is called from |
|
1113 // CAknProgressDialog::OkToExitL. |
|
1114 // This means that if DialogDismissedL LEAVEs, CAknProgressDialog fails to |
|
1115 // exit. |
|
1116 // We want to kill our ProgressDialog even though SyncL leaves, |
|
1117 // so we decide to TRAP SyncL. |
|
1118 // ----------------------------------------------------------------------------- |
|
1119 // |
|
1120 void CNotepadListDialog::DialogDismissedL( TInt /*aButtonId*/ ) |
|
1121 { |
|
1122 iModel->CancelDeletion(); |
|
1123 DrawDeferred(); |
|
1124 } |
|
1125 |
|
1126 // ----------------------------------------------------------------------------- |
|
1127 // CNotepadListDialog::PreLayoutDynInitL |
|
1128 // from CEikDialog |
|
1129 // ----------------------------------------------------------------------------- |
|
1130 // |
|
1131 void CNotepadListDialog::PreLayoutDynInitL() |
|
1132 { |
|
1133 iListBox = STATIC_CAST(CAknColumnListBox*, Control(ENotepadIdListBox)); |
|
1134 __ASSERT_DEBUG( iListBox, Panic(ENotepadLibraryPanicNullListControl) ); |
|
1135 iListBox->SetListBoxObserver(this); |
|
1136 if ( IsTemplates() ) |
|
1137 { |
|
1138 HBufC* text = iCoeEnv->AllocReadResourceLC(R_NOTEPAD_MCE_EMPTY_LIST); |
|
1139 iListBox->View()->SetListEmptyTextL(*text); |
|
1140 CleanupStack::PopAndDestroy(); // text |
|
1141 } |
|
1142 else |
|
1143 { |
|
1144 HBufC* primaryText = iCoeEnv->AllocReadResourceLC(R_NOTEPAD_EMPTY_LIST_PRIMARY_TEXT); |
|
1145 HBufC* secondaryText; |
|
1146 if(AknLayoutUtils::PenEnabled()) |
|
1147 { |
|
1148 secondaryText = iCoeEnv->AllocReadResourceLC(R_NOTEPAD_EMPTY_LIST_SECONDARY_TEXT); |
|
1149 } |
|
1150 else |
|
1151 { |
|
1152 secondaryText = iCoeEnv->AllocReadResourceLC(R_NOTEPAD_EMPTY_LIST_SECONDARY_TEXT_NONTOUCH); |
|
1153 } |
|
1154 HBufC* buf = HBufC::NewLC(KMaxFileName); |
|
1155 TPtr16 ptr = buf->Des(); |
|
1156 ptr.Append(*primaryText); |
|
1157 ptr.Append(KNewLine); |
|
1158 ptr.Append(*secondaryText); |
|
1159 |
|
1160 iListBox->View()->SetListEmptyTextL(ptr); |
|
1161 |
|
1162 CleanupStack::PopAndDestroy(buf); |
|
1163 CleanupStack::PopAndDestroy(secondaryText); |
|
1164 CleanupStack::PopAndDestroy(primaryText); |
|
1165 } |
|
1166 (iListBox->Model())->SetItemTextArray(iModel); |
|
1167 (iListBox->Model())->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
1168 CAknIconArray* iconArray = new(ELeave) CAknIconArray(1); |
|
1169 CleanupStack::PushL(iconArray); |
|
1170 CFbsBitmap* markBitmap = NULL; |
|
1171 CFbsBitmap* markBitmapMask = NULL; |
|
1172 |
|
1173 //CListItemDrawer is using this logical color as default for its marked icons |
|
1174 TRgb defaultColor; |
|
1175 defaultColor = CEikonEnv::Static()->Color(EColorControlText); |
|
1176 |
|
1177 AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(), |
|
1178 KAknsIIDQgnIndiMarkedAdd, |
|
1179 KAknsIIDQsnIconColors, |
|
1180 EAknsCIQsnIconColorsCG13, |
|
1181 markBitmap, |
|
1182 markBitmapMask, |
|
1183 KAvkonBitmapFile, |
|
1184 EMbmAvkonQgn_indi_marked_add, |
|
1185 EMbmAvkonQgn_indi_marked_add_mask, |
|
1186 defaultColor |
|
1187 ); |
|
1188 |
|
1189 CGulIcon* markIcon = CGulIcon::NewL(markBitmap,markBitmapMask); |
|
1190 iconArray->AppendL(markIcon); |
|
1191 if ( IsTemplates() ) |
|
1192 { |
|
1193 iconArray->AppendFromResourceL(R_NOTEPAD_TEMPLATE_ICON_ARRAY); |
|
1194 } |
|
1195 CleanupStack::Pop(); // iconArray |
|
1196 iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); |
|
1197 iListBox->CreateScrollBarFrameL(ETrue); |
|
1198 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1199 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
1200 // MSK |
|
1201 MiddleSoftKeyL(); |
|
1202 } |
|
1203 |
|
1204 // ----------------------------------------------------------------------------- |
|
1205 // CNotepadListDialog::PostLayoutDynInitL |
|
1206 // ----------------------------------------------------------------------------- |
|
1207 // |
|
1208 void CNotepadListDialog::PostLayoutDynInitL() |
|
1209 { |
|
1210 iListBox->UpdateScrollBarsL(); // indispensable |
|
1211 } |
|
1212 |
|
1213 // ----------------------------------------------------------------------------- |
|
1214 // CNotepadListDialog::OkToExitL |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // |
|
1217 TBool CNotepadListDialog::OkToExitL( TInt aButtonId ) |
|
1218 { |
|
1219 iFlags &= ~ENotepadMenuByOkKey; |
|
1220 TBool isOk(ETrue); |
|
1221 iMskFlag=EFalse; |
|
1222 //if txt file is more than 1M, editor will exit, so iEditorFlag should be set false. |
|
1223 if (iEditorDialog == NULL) |
|
1224 { |
|
1225 iEditorFlag = EFalse; |
|
1226 } |
|
1227 switch ( aButtonId ) |
|
1228 { |
|
1229 case EAknSoftkeyContextOptions: |
|
1230 { |
|
1231 iMskFlag=ETrue; |
|
1232 if(shiftflag) |
|
1233 { |
|
1234 shiftflag =EFalse; |
|
1235 iListBox->View()->ToggleItemL(iListBox->View()->CurrentItemIndex()); |
|
1236 MiddleSoftKeyL(); |
|
1237 isOk= EFalse; |
|
1238 break; |
|
1239 } |
|
1240 if(iModel->MdcaCount() == 0 || iListBox->SelectionIndexes()->Count()) |
|
1241 { |
|
1242 iFlags |= ENotepadMenuByOkKey; |
|
1243 DisplayMenuL(); |
|
1244 isOk= EFalse; |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 ProcessCommandL(ENotepadCmdOpen); |
|
1249 isOk= EFalse; |
|
1250 } |
|
1251 } |
|
1252 break; |
|
1253 case ENotepadCmdOpen: |
|
1254 if(shiftflag) |
|
1255 { |
|
1256 shiftflag =EFalse; |
|
1257 iListBox->View()->ToggleItemL(iListBox->View()->CurrentItemIndex()); |
|
1258 MiddleSoftKeyL(); |
|
1259 isOk= EFalse; |
|
1260 break; |
|
1261 } |
|
1262 ProcessCommandL(ENotepadCmdOpen); |
|
1263 isOk= EFalse; |
|
1264 break; |
|
1265 case ENotepadCmdAdd: |
|
1266 |
|
1267 OnCmdAddL(); |
|
1268 isOk= EFalse; |
|
1269 break; |
|
1270 case EAknSoftkeyExit: // list of memos |
|
1271 iAvkonAppUi->ProcessCommandL(EAknCmdExit); |
|
1272 isOk = EFalse; |
|
1273 break; |
|
1274 case EAknSoftkeyBack: // list of templates |
|
1275 isOk = ETrue; |
|
1276 break; |
|
1277 default: |
|
1278 if ( !iEditorFlag ) |
|
1279 { |
|
1280 isOk = CNotepadDialogBase::OkToExitL( aButtonId ); |
|
1281 } |
|
1282 else |
|
1283 { |
|
1284 isOk = EFalse; |
|
1285 } |
|
1286 break; |
|
1287 } |
|
1288 return isOk; |
|
1289 } |
|
1290 |
|
1291 // ----------------------------------------------------------------------------- |
|
1292 // CNotepadListDialog::HandleListBoxEventL |
|
1293 // from MEikListBoxObserver |
|
1294 // ----------------------------------------------------------------------------- |
|
1295 // |
|
1296 void CNotepadListDialog::HandleListBoxEventL( |
|
1297 CEikListBox* aListBox, |
|
1298 TListBoxEvent aEventType ) |
|
1299 { |
|
1300 switch(aEventType) |
|
1301 { |
|
1302 case EEventEnterKeyPressed: |
|
1303 OnCmdOpenL(aListBox->CurrentItemIndex()); |
|
1304 break; |
|
1305 case EEventItemSingleClicked: |
|
1306 if ( aListBox->Model()->NumberOfItems() != 0 |
|
1307 && aListBox->SelectionIndexes()->Count() == 0 ) |
|
1308 { |
|
1309 HandleListBoxPointerEventL( CNotepadListDialog::EOpenListBoxItem ); |
|
1310 } |
|
1311 else |
|
1312 { |
|
1313 HandleListBoxPointerEventL( CNotepadListDialog::EOpenListBoxContextMenu ); |
|
1314 } |
|
1315 if( IsTemplates() && AknLayoutUtils::PenEnabled() ) |
|
1316 { |
|
1317 if( !aListBox->SelectionIndexes()->Count() ) |
|
1318 { |
|
1319 OnCmdOpenL(aListBox->CurrentItemIndex()); |
|
1320 } |
|
1321 else |
|
1322 { |
|
1323 iFlags |= ENotepadMenuByOkKey; |
|
1324 iMskFlag=ETrue; |
|
1325 DisplayMenuL(); |
|
1326 } |
|
1327 } |
|
1328 default: |
|
1329 break; |
|
1330 } |
|
1331 MiddleSoftKeyL(); |
|
1332 } |
|
1333 |
|
1334 // ----------------------------------------------------------------------------- |
|
1335 // CNotepadListDialog::GetHelpContext |
|
1336 // from CCoeControl |
|
1337 // ----------------------------------------------------------------------------- |
|
1338 // |
|
1339 void CNotepadListDialog::GetHelpContext(TCoeHelpContext& aContext) const |
|
1340 { |
|
1341 switch ( iResId ) |
|
1342 { |
|
1343 case R_NOTEPAD_LIST_DIALOG_ORG: |
|
1344 aContext.iMajor = KUidNotepad; |
|
1345 aContext.iContext = KNMAKE_HLP_MEMO_LIST; |
|
1346 break; |
|
1347 case R_NOTEPAD_TEMPLATE_LIST_DIALOG_ORG: |
|
1348 aContext.iMajor = KUidMce; |
|
1349 aContext.iContext = KMCE_HLP_TEMPLATES; |
|
1350 break; |
|
1351 default: |
|
1352 break; |
|
1353 } |
|
1354 } |
|
1355 |
|
1356 // ----------------------------------------------------------------------------- |
|
1357 // CNotepadListDialog::OfferKeyEventL |
|
1358 // from CCoeControl |
|
1359 // |
|
1360 // Notepad specification says that |
|
1361 // in pushing numeric keys in list mode, Notepad will change into |
|
1362 // edit mode for a new memo and |
|
1363 // the numeric key code is insert in the opened editor. |
|
1364 // The problem is that Multi-tap FEP requires |
|
1365 // KeyDown event to start FepInlineEdit. If Multi-tap FEP catch KeyIn event |
|
1366 // without any preceeding KeyDown event, it will crash. |
|
1367 // So we decide to add simulated KeyDown event for multi-tap FEP. |
|
1368 // This is done in CNotepadEditorDialog. |
|
1369 // ----------------------------------------------------------------------------- |
|
1370 // |
|
1371 TKeyResponse CNotepadListDialog::OfferKeyEventL( |
|
1372 const TKeyEvent& aKeyEvent, |
|
1373 TEventCode aType ) |
|
1374 { |
|
1375 TBool hashKey = (aKeyEvent.iScanCode == EStdKeyHash ) ? ETrue : EFalse; |
|
1376 shiftflag =EFalse; |
|
1377 TKeyResponse keyResponse(EKeyWasConsumed); |
|
1378 if ( MenuShowing() || aType != EEventKey || |
|
1379 ( aKeyEvent.iModifiers & EAllStdModifiers ) ) |
|
1380 { |
|
1381 keyResponse = CAknDialog::OfferKeyEventL(aKeyEvent, aType); |
|
1382 if((aKeyEvent.iModifiers & EModifierShift) && (aType & EEventKeyDown)) |
|
1383 { |
|
1384 shiftflag = ETrue; |
|
1385 MiddleSoftKeyL(); |
|
1386 } |
|
1387 |
|
1388 if(aType == EEventKeyUp && hashKey) |
|
1389 { |
|
1390 MiddleSoftKeyL(); |
|
1391 } |
|
1392 } |
|
1393 else if ( aKeyEvent.iCode == EKeyBackspace ) |
|
1394 { |
|
1395 // Clear key make deletion |
|
1396 // |
|
1397 OnCmdDeleteL(); |
|
1398 } |
|
1399 else if ( (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) && |
|
1400 (iModel->MdcaCount() == 0 |
|
1401 || iListBox->SelectionIndexes()->Count())) |
|
1402 { |
|
1403 iFlags |= ENotepadMenuByOkKey; |
|
1404 DisplayMenuL(); |
|
1405 return keyResponse; |
|
1406 } |
|
1407 else if ( TChar(aKeyEvent.iCode).IsAlphaDigit() ) |
|
1408 { |
|
1409 OnCmdAddL(); |
|
1410 iEditorDialog->SetInitialKeyEventL(aKeyEvent); |
|
1411 } |
|
1412 else |
|
1413 { |
|
1414 keyResponse = CAknDialog::OfferKeyEventL(aKeyEvent, aType); |
|
1415 } |
|
1416 return keyResponse; |
|
1417 } |
|
1418 |
|
1419 // --------------------------------------------------------- |
|
1420 // CNotepadListDialog::HandleResourceChange |
|
1421 // Notifier for changing orientation |
|
1422 // --------------------------------------------------------- |
|
1423 // |
|
1424 void CNotepadListDialog::HandleResourceChange(TInt aType) |
|
1425 { |
|
1426 if (aType == KEikDynamicLayoutVariantSwitch) |
|
1427 { |
|
1428 SetRect(iAvkonAppUi->ClientRect()); |
|
1429 iListBox->HandleResourceChange(aType); |
|
1430 iListBox->DrawDeferred(); |
|
1431 } |
|
1432 else |
|
1433 { |
|
1434 CAknDialog::HandleResourceChange(aType); |
|
1435 } |
|
1436 } |
|
1437 |
|
1438 // ----------------------------------------------------------------------------- |
|
1439 // CNotepadListDialog::ClearSavedMarkListItems() |
|
1440 // ----------------------------------------------------------------------------- |
|
1441 // |
|
1442 void CNotepadListDialog::ClearSaveOrMarkedListItemsL(TBool aFlag) |
|
1443 { |
|
1444 if( aFlag ) |
|
1445 { |
|
1446 iListBox->ClearSelection(); |
|
1447 iListBox->DrawDeferred(); |
|
1448 MiddleSoftKeyL(); |
|
1449 } |
|
1450 |
|
1451 ClearSavedCurrentAndSelections(); |
|
1452 } |
|
1453 // CNotepadListDialog::CNotepadListDialog_Reserved |
|
1454 // ----------------------------------------------------------------------------- |
|
1455 // |
|
1456 EXPORT_C void CNotepadListDialog::CNotepadListDialog_Reserved() |
|
1457 { |
|
1458 } |
|
1459 |
|
1460 // ----------------------------------------------------------------------------- |
|
1461 // CNotepadListDialog::CNotepadIdle::NewLC |
|
1462 // ----------------------------------------------------------------------------- |
|
1463 // |
|
1464 CNotepadListDialog::CNotepadIdle* CNotepadListDialog::CNotepadIdle::NewLC( |
|
1465 TBool aIsAddingFocusedItem ) |
|
1466 { |
|
1467 CNotepadIdle* self = new(ELeave) CNotepadIdle(aIsAddingFocusedItem); |
|
1468 CleanupStack::PushL(self); |
|
1469 self->ConstructL(); |
|
1470 return self; // self stays on CleanupStack |
|
1471 } |
|
1472 |
|
1473 // ----------------------------------------------------------------------------- |
|
1474 // CNotepadListDialog::CNotepadIdle::~CNotepadIdle |
|
1475 // ----------------------------------------------------------------------------- |
|
1476 // |
|
1477 CNotepadListDialog::CNotepadIdle::~CNotepadIdle() |
|
1478 { |
|
1479 } |
|
1480 |
|
1481 // ----------------------------------------------------------------------------- |
|
1482 // CNotepadListDialog::CNotepadIdle::ConstructL |
|
1483 // ----------------------------------------------------------------------------- |
|
1484 // |
|
1485 void CNotepadListDialog::CNotepadIdle::ConstructL() |
|
1486 { |
|
1487 CActiveScheduler::Add(this); |
|
1488 } |
|
1489 |
|
1490 // ----------------------------------------------------------------------------- |
|
1491 // CNotepadListDialog::CNotepadProgressDialog::CNotepadProgressDialog |
|
1492 // ----------------------------------------------------------------------------- |
|
1493 // |
|
1494 CNotepadListDialog::CNotepadProgressDialog::CNotepadProgressDialog( |
|
1495 CEikDialog** aSelfPtr, |
|
1496 TBool aVisibilityDelayOff ) |
|
1497 :CAknProgressDialog(aSelfPtr, aVisibilityDelayOff) |
|
1498 { |
|
1499 } |
|
1500 |
|
1501 // ----------------------------------------------------------------------------- |
|
1502 // CNotepadListDialog::CNotepadProgressDialog::~CNotepadProgressDialog |
|
1503 // ----------------------------------------------------------------------------- |
|
1504 // |
|
1505 CNotepadListDialog::CNotepadProgressDialog::~CNotepadProgressDialog() |
|
1506 { |
|
1507 delete iInts; |
|
1508 } |
|
1509 |
|
1510 // ----------------------------------------------------------------------------- |
|
1511 // CNotepadListDialog::CNotepadProgressDialog::PrepareL |
|
1512 // ----------------------------------------------------------------------------- |
|
1513 // |
|
1514 void CNotepadListDialog::CNotepadProgressDialog::PrepareL( |
|
1515 const TInt aCount, |
|
1516 const TInt aLabelResId ) |
|
1517 { |
|
1518 iProgressInfo = GetProgressInfoL(); |
|
1519 switch ( aLabelResId ) |
|
1520 { |
|
1521 case R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATE: // delete one template |
|
1522 { |
|
1523 HBufC* buf = StringLoader::LoadLC(R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATE); |
|
1524 SetTextL(*buf); |
|
1525 CleanupStack::PopAndDestroy(buf); |
|
1526 } |
|
1527 break; |
|
1528 case R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATES: // delete templates |
|
1529 { |
|
1530 iInts = new(ELeave) CArrayFixFlat<TInt>(2); |
|
1531 iInts->AppendL(0); |
|
1532 iInts->AppendL(aCount); |
|
1533 IncrementL(0); // SetTextL |
|
1534 } |
|
1535 break; |
|
1536 default: |
|
1537 break; |
|
1538 } |
|
1539 } |
|
1540 |
|
1541 // ----------------------------------------------------------------------------- |
|
1542 // CNotepadListDialog::CNotepadProgressDialog::IncrementL |
|
1543 // ----------------------------------------------------------------------------- |
|
1544 // |
|
1545 void CNotepadListDialog::CNotepadProgressDialog::IncrementL( |
|
1546 const TInt aIncrement) |
|
1547 { |
|
1548 __ASSERT_DEBUG(iProgressInfo, |
|
1549 Panic(ENotepadLibraryPanicProgressDialogNotReady)); |
|
1550 if ( iInts ) // IsTemplates |
|
1551 { |
|
1552 (*iInts)[0] = aIncrement + iProgressInfo->CurrentValue(); |
|
1553 HBufC* prompt = StringLoader::LoadLC( |
|
1554 R_NOTEPAD_MCE_WAIT_NOTE_DELETE_TEMPLATES, *iInts, iCoeEnv ); |
|
1555 SetTextL(prompt->Des()); |
|
1556 CleanupStack::PopAndDestroy(); // prompt |
|
1557 } |
|
1558 iProgressInfo->IncrementAndDraw(aIncrement); |
|
1559 } |
|
1560 |
|
1561 // ----------------------------------------------------------------------------- |
|
1562 // CNotepadListDialog::CNotepadProgressDialog::ProcessFinishedL |
|
1563 // ----------------------------------------------------------------------------- |
|
1564 // |
|
1565 void CNotepadListDialog::CNotepadProgressDialog::ProcessFinishedL() |
|
1566 { |
|
1567 iProgressInfo->SetAndDraw(iProgressInfo->Info().iFinalValue); |
|
1568 CAknProgressDialog::ProcessFinishedL(); |
|
1569 } |
|
1570 |
|
1571 // ----------------------------------------------------------------------------- |
|
1572 // CNotepadListDialog::HandleListBoxPointerEventL |
|
1573 // ----------------------------------------------------------------------------- |
|
1574 // |
|
1575 void CNotepadListDialog::HandleListBoxPointerEventL(TNotepadListBoxEvent aEvent) |
|
1576 { |
|
1577 if(aEvent == EOpenListBoxContextMenu && !MenuShowing()) |
|
1578 { |
|
1579 if(iEditorFlag==EFalse) |
|
1580 { |
|
1581 iFlags |= ENotepadMenuByOkKey; |
|
1582 iMskFlag=ETrue; |
|
1583 DisplayMenuL(); |
|
1584 } |
|
1585 } |
|
1586 else if(aEvent == EOpenListBoxItem) |
|
1587 { |
|
1588 if ( !iEditorDialog&& !IsTemplates() ) |
|
1589 { |
|
1590 OnCmdOpenL( iListBox->CurrentItemIndex() ); |
|
1591 } |
|
1592 } |
|
1593 } |
|
1594 |
|
1595 // ----------------------------------------------------------------------------- |
|
1596 // CNotepadListDialog::MiddleSoftKeyL() |
|
1597 // ----------------------------------------------------------------------------- |
|
1598 // |
|
1599 |
|
1600 void CNotepadListDialog::MiddleSoftKeyL() |
|
1601 { |
|
1602 const TInt markCount( iListBox->SelectionIndexes()->Count() ); |
|
1603 |
|
1604 if( !IsTemplates() ) // Notepad ListView |
|
1605 { |
|
1606 if( (iModel->MdcaCount() == 0)) |
|
1607 { |
|
1608 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_EXIT_NEW ); |
|
1609 } |
|
1610 else |
|
1611 { |
|
1612 if( markCount > 0 ) |
|
1613 { |
|
1614 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_EXIT_CONTEXTOPTIONS ); |
|
1615 } |
|
1616 else |
|
1617 { |
|
1618 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_OPEN_EXIT ); |
|
1619 } |
|
1620 } |
|
1621 } |
|
1622 else // Messaging Templates Listview (Notepad view) |
|
1623 { |
|
1624 if( (iModel->MdcaCount() == 0)) |
|
1625 { |
|
1626 |
|
1627 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_BACK_NEW ); |
|
1628 } |
|
1629 else |
|
1630 { |
|
1631 if(markCount > 0 ) |
|
1632 { |
|
1633 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_BACK_CONTEXTOPTIONS ); |
|
1634 } |
|
1635 else |
|
1636 { |
|
1637 ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_OPEN_BACK ); |
|
1638 } |
|
1639 } |
|
1640 } |
|
1641 |
|
1642 ButtonGroupContainer().DrawNow(); |
|
1643 } |
|
1644 |
|
1645 // ---------------------------------------------------------------------------- |
|
1646 // CNotepadListDialog::HandleNotifyL |
|
1647 // (may leave) |
|
1648 // ---------------------------------------------------------------------------- |
|
1649 // |
|
1650 TInt CNotepadListDialog::HandleNotifyL( TInt /* aCmdId */, |
|
1651 TInt /* aEventId */, |
|
1652 CAiwGenericParamList& /* aEventParamList */, |
|
1653 const CAiwGenericParamList& aInParamList |
|
1654 ) |
|
1655 { |
|
1656 #if 0 |
|
1657 // Extract service command |
|
1658 const TAiwGenericParam* errorParam = NULL; |
|
1659 TInt index = 0; |
|
1660 errorParam = aInParamList.FindFirst( index, |
|
1661 EGenericParamError, |
|
1662 EVariantTypeTInt32 |
|
1663 ); |
|
1664 TInt error = KErrNone; |
|
1665 if ( errorParam ) |
|
1666 { |
|
1667 error = errorParam->Value().AsTInt32(); |
|
1668 } |
|
1669 |
|
1670 if ( error != KErrNone ) |
|
1671 { |
|
1672 // Error handling here |
|
1673 } |
|
1674 #endif // 0 |
|
1675 |
|
1676 return KErrNone; |
|
1677 } |
|
1678 |
|
1679 // End of File |
|
1680 |
|
1681 |