|
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: sms sim dlg implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include <eikmenup.h> |
|
22 #include <aknViewAppUi.h> // iAvkonViewAppUi |
|
23 #include <AknWaitDialog.h> // CAknWaitDialog |
|
24 #include <eikprogi.h> // CEikProgressInfo |
|
25 #include <AknQueryDialog.h> // CAknQueryDialog |
|
26 #include <aknlists.h> |
|
27 #include <StringLoader.h> // StringLoader |
|
28 #include <avkon.mbg> // bitmaps |
|
29 #include <akntitle.h> // CAknTitlePane |
|
30 #include <AknIconArray.h> // CAknIconArray |
|
31 #include <hlplch.h> // For HlpLauncher |
|
32 #include <bldvariant.hrh> |
|
33 #include <featmgr.h> // FeatureManager |
|
34 #include <data_caging_path_literals.hrh> |
|
35 // message includes |
|
36 #include <msvapi.h> // for CMsvSession |
|
37 #include <akninputblock.h> // CAknInputBlock |
|
38 #include <MsgFolderSelectionDialog.h> // CMsgFolderSelectionDialog |
|
39 #include <MuiuOperationWait.h> // CMuiuOperationWait |
|
40 #include <muiu.mbg> // bitmaps |
|
41 #include <smscmds.h> // for async sms commands |
|
42 #include <smutset.h> // for TSmsProgress |
|
43 |
|
44 #include <defaultsimdialog.rsg> // for resource ids |
|
45 #include <csxhelp/mce.hlp.hrh> |
|
46 #include <aknconsts.h> // KAvkonBitmapFile |
|
47 #include <AknsUtils.h> |
|
48 #include <AknIconUtils.h> // AknIconUtils::AvkonIconFileName() |
|
49 #include <AknsConstants.h> |
|
50 #include <AknUtils.h> |
|
51 #include <aknnotewrappers.h> //for displayingnote |
|
52 #include <Profile.hrh> // for profile state |
|
53 #include <ProfileEngineSDKCRKeys.h> |
|
54 #include <centralrepository.h> |
|
55 #include <bautils.h> // BaflUtils |
|
56 #include <ConeResLoader.h> // RConeResourceLoader |
|
57 |
|
58 #include "simdeletecopyoperation.h" // for CSimDeleteCopyOperation |
|
59 #include "SMSU.H" // for CSmsMtmUi |
|
60 #include "smssimdialog.h" // for CSmsSimDialog |
|
61 #include "SMSU.HRH" // for command ids |
|
62 //For logging |
|
63 #include "SmumLogging.h" |
|
64 |
|
65 // LOCAL CONSTANTS AND MACROS |
|
66 const TInt KSimMessageBitmapArrayGranularity = 4; |
|
67 const TInt KSimMessageTempArrayGranularity = 4; |
|
68 const TInt KSmumSimDialogMessageBitmapIndex = 1; |
|
69 |
|
70 _LIT( KSimDlgResourceFile, "defaultsimdialog.rsc" ); |
|
71 _LIT( KMuiuBitmapFile, "Muiu.MBM" ); |
|
72 _LIT( KSmsiMarkReplacement, "1"); |
|
73 |
|
74 // |
|
75 // |
|
76 // CSimMessageArray |
|
77 // |
|
78 // |
|
79 |
|
80 // ---------------------------------------------------- |
|
81 // CSimMessageArray::CSimMessageArray |
|
82 // ---------------------------------------------------- |
|
83 CSimMessageArray::CSimMessageArray( CMsvSession& aSession ): |
|
84 iSession( aSession ) |
|
85 { |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------- |
|
89 // CSimMessageArray::NewL |
|
90 // ---------------------------------------------------- |
|
91 CSimMessageArray* CSimMessageArray::NewL( CMsvSession& aSession ) |
|
92 { |
|
93 SMUMLOGGER_ENTERFN(" CSimMessageArray::NewL"); |
|
94 CSimMessageArray* self = new (ELeave) CSimMessageArray(aSession); |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL(); |
|
97 CleanupStack::Pop( self ); |
|
98 SMUMLOGGER_LEAVEFN(" CSimMessageArray::NewL"); |
|
99 return self; |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------- |
|
103 // CSimMessageArray::ConstructL |
|
104 // ---------------------------------------------------- |
|
105 void CSimMessageArray::ConstructL() |
|
106 { |
|
107 SMUMLOGGER_ENTERFN(" CSimMessageArray::ConstructL"); |
|
108 TMsvSelectionOrdering ordering = TMsvSelectionOrdering( |
|
109 KMsvNoGrouping, |
|
110 EMsvSortByDescription, |
|
111 ETrue ); |
|
112 |
|
113 iSmsServiceEntry = CMsvEntry::NewL( |
|
114 iSession, |
|
115 KMsvRootIndexEntryId, |
|
116 ordering ); |
|
117 |
|
118 iListBoxText = HBufC::NewL( KSmumMaxDisplayTextLength ); |
|
119 SMUMLOGGER_LEAVEFN(" CSimMessageArray::ConstructL"); |
|
120 } |
|
121 |
|
122 |
|
123 // ---------------------------------------------------- |
|
124 // CSimMessageArray::~CSimMessageArray |
|
125 // ---------------------------------------------------- |
|
126 CSimMessageArray::~CSimMessageArray() |
|
127 { |
|
128 SMUMLOGGER_ENTERFN(" CSimMessageArray::~CSimMessageArray"); |
|
129 delete iSmsServiceEntry; |
|
130 delete iListBoxText; |
|
131 SMUMLOGGER_LEAVEFN(" CSimMessageArray::~CSimMessageArray"); |
|
132 } |
|
133 |
|
134 // ---------------------------------------------------- |
|
135 // CSimMessageArray::MdcaCount |
|
136 // ---------------------------------------------------- |
|
137 TInt CSimMessageArray::MdcaCount() const |
|
138 { |
|
139 SMUMLOGGER_ENTERFN(" CSimMessageArray::MdcaCount"); |
|
140 if ( iSmsServiceEntry->EntryId() == KMsvRootIndexEntryId ) |
|
141 { |
|
142 SMUMLOGGER_LEAVEFN(" CSimMessageArray::MdcaCount - 0"); |
|
143 return 0; |
|
144 } |
|
145 else |
|
146 { |
|
147 SMUMLOGGER_LEAVEFN(" CSimMessageArray::MdcaCount - COUNT"); |
|
148 return iSmsServiceEntry->Count(); |
|
149 } |
|
150 } |
|
151 |
|
152 // ---------------------------------------------------- |
|
153 // CSimMessageArray::MdcaPoint |
|
154 // ---------------------------------------------------- |
|
155 TPtrC CSimMessageArray::MdcaPoint(TInt aIndex) const |
|
156 { |
|
157 SMUMLOGGER_ENTERFN(" CSimMessageArray::MdcaCount(INDEX)"); |
|
158 // prepare |
|
159 TPtr tempText = iListBoxText->Des(); |
|
160 tempText.Zero(); |
|
161 const TMsvEntry* child = NULL; |
|
162 child = &(*iSmsServiceEntry)[ aIndex ]; |
|
163 |
|
164 // construct listbox-string |
|
165 // bitmap |
|
166 tempText.AppendNum( KSmumSimDialogMessageBitmapIndex ); |
|
167 tempText.Append( KColumnListSeparator ); |
|
168 // sender-information |
|
169 if ( child->iDetails.Length() > KSmumMaxVisibleChars ) |
|
170 { |
|
171 tempText.Append( child->iDetails.Left( KSmumMaxVisibleChars-1 ) ); |
|
172 tempText.Append( CEditableText::EEllipsis ); |
|
173 } |
|
174 else |
|
175 { |
|
176 tempText.Append( child->iDetails ); |
|
177 } |
|
178 |
|
179 // msg "subject" |
|
180 tempText.Append( KColumnListSeparator ); |
|
181 if ( child->iDescription.Length() > KSmumMaxVisibleChars ) |
|
182 { |
|
183 tempText.Append( child->iDescription.Left( KSmumMaxVisibleChars-1 ) ); |
|
184 tempText.Append( CEditableText::EEllipsis ); |
|
185 } |
|
186 else |
|
187 { |
|
188 tempText.Append( child->iDescription ); |
|
189 } |
|
190 |
|
191 SMUMLOGGER_LEAVEFN(" CSimMessageArray::MdcaCount(INDEX)"); |
|
192 return tempText; |
|
193 } |
|
194 |
|
195 |
|
196 // ---------------------------------------------------- |
|
197 // CSimMessageArray::EntryId |
|
198 // ---------------------------------------------------- |
|
199 TMsvId CSimMessageArray::EntryId( TInt aIndex ) const |
|
200 { |
|
201 return (*iSmsServiceEntry)[ aIndex ].Id(); |
|
202 } |
|
203 |
|
204 // ---------------------------------------------------- |
|
205 // CSimMessageArray::RefreshArrayL |
|
206 // ---------------------------------------------------- |
|
207 void CSimMessageArray::RefreshArrayL( TMsvId aFolderId ) |
|
208 { |
|
209 iSmsServiceEntry->SetEntryL( KMsvDeletedEntryFolderEntryId ); |
|
210 iSmsServiceEntry->SetEntryL( aFolderId ); |
|
211 } |
|
212 |
|
213 |
|
214 |
|
215 // |
|
216 // |
|
217 // CSmsSimDialog |
|
218 // |
|
219 // |
|
220 |
|
221 // ---------------------------------------------------- |
|
222 // CSmsSimDialog::CSmsSimDialog |
|
223 // ---------------------------------------------------- |
|
224 CSmsSimDialog::CSmsSimDialog(CSmsMtmUi& aSmsMtmUi, CMsvSession& aSession, TInt& aExitCode): |
|
225 iSmsMtmUi(aSmsMtmUi), |
|
226 iSession(aSession), |
|
227 iExitCode( aExitCode ), |
|
228 iDialogDismissed( EFalse ), |
|
229 iHelpFeatureSupported( EFalse ), |
|
230 iMsgCountBeforeOperation( 0 ), |
|
231 iResourceFileOffset(0), |
|
232 iContextCommand(EFalse) |
|
233 { |
|
234 SMUMLOGGER_ENTERFN(" CSmsSimDialog::CSmsSimDialog"); |
|
235 iExitCode = KErrNone; |
|
236 iMarkReplacementText.Copy( KSmsiMarkReplacement ); |
|
237 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::CSmsSimDialog"); |
|
238 } |
|
239 |
|
240 // ---------------------------------------------------- |
|
241 // CSmsSimDialog::~CSmsSimDialog |
|
242 // ---------------------------------------------------- |
|
243 CSmsSimDialog::~CSmsSimDialog() |
|
244 { |
|
245 SMUMLOGGER_ENTERFN(" CSmsSimDialog::~CSmsSimDialog"); |
|
246 if( iResourceFileOffset ) |
|
247 { |
|
248 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
249 } |
|
250 |
|
251 delete iOldTitleText; |
|
252 delete iEnumerationOperation; |
|
253 delete iCopyOrDeleteOperation; |
|
254 delete iProgressDialog; |
|
255 delete iWaitDialog; |
|
256 delete iMessages; |
|
257 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::~CSmsSimDialog"); |
|
258 } |
|
259 |
|
260 // ---------------------------------------------------- |
|
261 // CSmsSimDialog::NewL |
|
262 // ---------------------------------------------------- |
|
263 CSmsSimDialog* CSmsSimDialog::NewL(CSmsMtmUi& aSmsMtmUi, CMsvSession& aSession, TInt& aExitCode) |
|
264 { |
|
265 SMUMLOGGER_ENTERFN(" CSmsSimDialog::NewL"); |
|
266 CSmsSimDialog* self= new(ELeave) CSmsSimDialog(aSmsMtmUi, aSession, aExitCode); |
|
267 CleanupStack::PushL(self); |
|
268 self->ConstructL(); |
|
269 CleanupStack::Pop(); |
|
270 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::NewL"); |
|
271 return self; |
|
272 } |
|
273 |
|
274 // ---------------------------------------------------- |
|
275 // CSmsSimDialog::ConstructL |
|
276 // ---------------------------------------------------- |
|
277 void CSmsSimDialog::ConstructL() |
|
278 { |
|
279 SMUMLOGGER_ENTERFN(" CSmsSimDialog::ConstructL"); |
|
280 |
|
281 // Resource loader |
|
282 CEikonEnv* env = CEikonEnv::Static(); |
|
283 TParse fp; |
|
284 fp.Set( KSimDlgResourceFile, &KDC_RESOURCE_FILES_DIR , NULL ); |
|
285 TFileName filename = fp.FullName(); |
|
286 BaflUtils::NearestLanguageFile(env->FsSession(), filename); |
|
287 iResourceFileOffset = env->AddResourceFileL(filename); |
|
288 |
|
289 CAknDialog::ConstructL( R_SMS_DEFAULT_SIM_DIALOG_MENUBAR ); |
|
290 iMessages = CSimMessageArray::NewL( iSession ); |
|
291 |
|
292 // Prepare FeatureManager, read values to members and uninitialize FeatureManager |
|
293 FeatureManager::InitializeLibL(); |
|
294 iHelpFeatureSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
295 FeatureManager::UnInitializeLib(); |
|
296 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::ConstructL"); |
|
297 } |
|
298 |
|
299 // ---------------------------------------------------- |
|
300 // CSmsSimDialog::PreLayoutDynInitL |
|
301 // ---------------------------------------------------- |
|
302 void CSmsSimDialog::PreLayoutDynInitL() |
|
303 { |
|
304 SMUMLOGGER_ENTERFN(" CSmsSimDialog::PreLayoutDynInitL"); |
|
305 CEikColumnListBox* listBox = ListBox(); |
|
306 listBox->SetListBoxObserver( this ); |
|
307 |
|
308 // Create scroll bar |
|
309 listBox->CreateScrollBarFrameL(); |
|
310 listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
311 |
|
312 // Set data |
|
313 listBox->Model()->SetItemTextArray(iMessages); |
|
314 listBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
315 HBufC* noMessages = StringLoader::LoadLC( R_SMS_DEFAULT_SIM_DIALOG_EMPTY, iCoeEnv ); |
|
316 listBox->View()->SetListEmptyTextL( *noMessages ); |
|
317 CleanupStack::PopAndDestroy( noMessages ); |
|
318 noMessages = NULL; |
|
319 |
|
320 StoreTitleTextAndSetNewL(); |
|
321 |
|
322 // create icon array |
|
323 CArrayPtr< CGulIcon >* icons = |
|
324 new( ELeave ) CAknIconArray( KSimMessageBitmapArrayGranularity ); |
|
325 CleanupStack::PushL( icons ); |
|
326 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
327 |
|
328 TFileName fileName; |
|
329 fileName.Copy( KAvkonBitmapFile ); |
|
330 icons->AppendL( |
|
331 AknsUtils::CreateGulIconL( skinInstance, |
|
332 KAknsIIDQgnIndiMarkedAdd, |
|
333 fileName, |
|
334 EMbmAvkonQgn_indi_marked_add, |
|
335 EMbmAvkonQgn_indi_marked_add_mask ) ); |
|
336 // Parse the filename |
|
337 TParse tp; |
|
338 tp.Set( KMuiuBitmapFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
339 fileName.Copy( tp.FullName() ); |
|
340 icons->AppendL( |
|
341 AknsUtils::CreateGulIconL( skinInstance, |
|
342 KAknsIIDQgnPropMceSmsRead, |
|
343 fileName, |
|
344 EMbmMuiuQgn_prop_mce_sms_read, |
|
345 EMbmMuiuQgn_prop_mce_sms_read_mask ) ); |
|
346 // Set the icon array. takes ownership |
|
347 reinterpret_cast<CAknDoubleGraphicStyleListBox*> |
|
348 (listBox)->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); |
|
349 CleanupStack::Pop(); // icons |
|
350 // Start the enumeration |
|
351 EnumerateSimMessagesL(); |
|
352 iMenuBar->SetContextMenuTitleResourceId( R_SMS_DEFAULT_SIM_DIALOG_CONTEXTMENUBAR ); |
|
353 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::PreLayoutDynInitL"); |
|
354 } |
|
355 |
|
356 // ---------------------------------------------------- |
|
357 // CSmsSimDialog::OkToExitL |
|
358 // ---------------------------------------------------- |
|
359 TBool CSmsSimDialog::OkToExitL(TInt aButtonId) |
|
360 { |
|
361 SMUMLOGGER_ENTERFN(" CSmsSimDialog::OkToExitL"); |
|
362 CAknInputBlock::NewLC(); // Absorb keys |
|
363 TInt returnValue = 0; |
|
364 |
|
365 switch(aButtonId) |
|
366 { |
|
367 case EAknSoftkeyEmpty: |
|
368 { |
|
369 returnValue = EFalse; |
|
370 } |
|
371 break; |
|
372 case EAknSoftkeyOptions: |
|
373 { |
|
374 iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); |
|
375 iMenuBar->TryDisplayMenuBarL(); |
|
376 returnValue = EFalse; |
|
377 } |
|
378 break; |
|
379 case EAknSoftkeyContextOptions: |
|
380 { |
|
381 iContextCommand = ETrue; |
|
382 // Middle softkey was pressed. Display context menu. |
|
383 iMenuBar->SetMenuType(CEikMenuBar::EMenuContext); |
|
384 iMenuBar->TryDisplayContextMenuBarL(); |
|
385 returnValue = EFalse; |
|
386 } |
|
387 break; |
|
388 default: |
|
389 { |
|
390 TBool okToExit = CAknDialog::OkToExitL( aButtonId ); |
|
391 if ( okToExit ) |
|
392 { |
|
393 TRAP_IGNORE( DeleteSimFolderL() ); |
|
394 if ( aButtonId != EEikBidCancel ) |
|
395 { |
|
396 TRAP_IGNORE( RestoreTitleTextL() ); |
|
397 } |
|
398 } |
|
399 returnValue = okToExit; |
|
400 } |
|
401 break; |
|
402 |
|
403 } |
|
404 |
|
405 CleanupStack::PopAndDestroy(); // CAknInputBlock |
|
406 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::OkToExitL"); |
|
407 return returnValue; |
|
408 } |
|
409 |
|
410 // ---------------------------------------------------- |
|
411 // CSmsSimDialog::ProcessCommandL |
|
412 // ---------------------------------------------------- |
|
413 void CSmsSimDialog::ProcessCommandL( TInt aCommandId ) |
|
414 { |
|
415 SMUMLOGGER_ENTERFN(" CSmsSimDialog::ProcessCommandL"); |
|
416 CAknDialog::ProcessCommandL( aCommandId ) ; |
|
417 CEikColumnListBox* listBox = ListBox(); |
|
418 CRepository* repository = CRepository::NewLC( KCRUidProfileEngine ); |
|
419 TInt defaultType( EProfileGeneralId ); |
|
420 User::LeaveIfError( repository->Get( KProEngActiveProfile, defaultType ) ); |
|
421 CleanupStack::PopAndDestroy( repository ); |
|
422 |
|
423 switch ( aCommandId ) |
|
424 { |
|
425 case ESmsMtmUiCommandIdCopy: |
|
426 //General system error pops up when deleting a SIM message in offline mode |
|
427 if ( defaultType == EProfileOffLineId ) |
|
428 { |
|
429 // Show note and exit |
|
430 HBufC* noteString = StringLoader::LoadLC( R_QTN_OFFLINE_NOT_POSSIBLE, iCoeEnv ); |
|
431 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
432 note->ExecuteLD( *noteString ); |
|
433 CleanupStack::PopAndDestroy(); // noteString |
|
434 TryExitL( EAknSoftkeyBack ); |
|
435 } |
|
436 else |
|
437 { |
|
438 HandleCopyFromSimToLocalFolderL(); |
|
439 } |
|
440 break; |
|
441 case ESmsMtmUiCommandIdDelete: |
|
442 //General system error pops up when deleting a SIM message in offline mode |
|
443 if ( defaultType == EProfileOffLineId ) |
|
444 { |
|
445 // Show note and exit |
|
446 HBufC* noteString = StringLoader::LoadLC( R_QTN_OFFLINE_NOT_POSSIBLE, iCoeEnv ); |
|
447 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
448 note->ExecuteLD( *noteString ); |
|
449 CleanupStack::PopAndDestroy(); // noteString |
|
450 TryExitL( EAknSoftkeyBack ); |
|
451 } |
|
452 else |
|
453 { |
|
454 HandleDeleteFromSimL(); |
|
455 } |
|
456 break; |
|
457 case ESmsMtmUiCommandIdEditMark: |
|
458 { |
|
459 #ifdef _DEBUG |
|
460 RDebug::Print(_L("CSmsSimDialog::ProcessCommandL: mark item %d"), |
|
461 listBox->CurrentItemIndex() ); |
|
462 #endif |
|
463 listBox->View()->SelectItemL( listBox->CurrentItemIndex() ); |
|
464 break; |
|
465 } |
|
466 case ESmsMtmUiCommandIdEditUnmark: |
|
467 { |
|
468 #ifdef _DEBUG |
|
469 RDebug::Print(_L("CSmsSimDialog::ProcessCommandL: unmark item %d"), |
|
470 listBox->CurrentItemIndex() ); |
|
471 #endif |
|
472 listBox->View()->DeselectItem( listBox->CurrentItemIndex() ); |
|
473 break; |
|
474 } |
|
475 case ESmsMtmUiCommandIdEditUnmarkAll: |
|
476 { |
|
477 #ifdef _DEBUG |
|
478 RDebug::Print(_L("CSmsSimDialog::ProcessCommandL: unmark all") ); |
|
479 #endif |
|
480 |
|
481 listBox->View()->ClearSelection(); |
|
482 break; |
|
483 } |
|
484 case ESmsMtmUiCommandIdEditMarkAll: |
|
485 { |
|
486 #ifdef _DEBUG |
|
487 RDebug::Print(_L("CSmsSimDialog::ProcessCommandL: mark all") ); |
|
488 #endif |
|
489 |
|
490 CArrayFixFlat<TInt>* indexArray = new( ELeave ) CArrayFixFlat<TInt>( |
|
491 KSimMessageTempArrayGranularity ); |
|
492 CleanupStack::PushL( indexArray ); |
|
493 const TInt count = listBox->Model()->NumberOfItems(); |
|
494 for ( TInt loop = 0; loop < count; loop++ ) |
|
495 { |
|
496 indexArray->AppendL( loop ); |
|
497 } |
|
498 listBox->View()->SetSelectionIndexesL( indexArray ); |
|
499 CleanupStack::PopAndDestroy(); // indexArray |
|
500 break; |
|
501 } |
|
502 case EAknCmdHelp: |
|
503 { |
|
504 LaunchHelpL(); |
|
505 } |
|
506 break; |
|
507 case ESmsSettingsChoiceMenuExit: |
|
508 { |
|
509 iExitCode = EEikCmdExit; |
|
510 TryExitL( EAknCmdExit ); |
|
511 } |
|
512 break; |
|
513 |
|
514 default : |
|
515 break; |
|
516 } |
|
517 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::ProcessCommandL"); |
|
518 } |
|
519 // ---------------------------------------------------- |
|
520 // CSmsSimDialog::DynInitMenuPaneL |
|
521 // ---------------------------------------------------- |
|
522 void CSmsSimDialog::DynInitMenuPaneL( |
|
523 TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
524 { |
|
525 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DynInitMenuPaneL - 2"); |
|
526 if ( aResourceId == R_SMS_DEFAULT_SIM_DIALOG_MENUPANE ) |
|
527 { |
|
528 if ( ListBox()->Model()->NumberOfItems() == 0 ) |
|
529 { |
|
530 aMenuPane->DeleteMenuItem( ESmsMtmUiCommandIdEdit ); |
|
531 } |
|
532 |
|
533 aMenuPane->SetItemDimmed( EAknCmdHelp, !iHelpFeatureSupported ); |
|
534 } |
|
535 else if ( aResourceId == R_MCE_DEFAULT_SIM_DIALOG_EDIT_CASCADE ) |
|
536 { |
|
537 DynInitEditMenuL( aMenuPane ); |
|
538 } |
|
539 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DynInitMenuPaneL - 2"); |
|
540 } |
|
541 |
|
542 // ---------------------------------------------------- |
|
543 // CSmsSimDialog::OfferKeyEventL |
|
544 // ---------------------------------------------------- |
|
545 TKeyResponse CSmsSimDialog::OfferKeyEventL( |
|
546 const TKeyEvent& aKeyEvent, |
|
547 TEventCode aType ) |
|
548 { |
|
549 SMUMLOGGER_ENTERFN(" CSmsSimDialog::OfferKeyEventL"); |
|
550 CEikColumnListBox* listBox = ListBox(); |
|
551 if ( listBox && aType == EEventKey && aKeyEvent.iCode == EKeyBackspace && |
|
552 listBox->Model()->NumberOfItems() > 0 ) |
|
553 { |
|
554 HandleDeleteFromSimL(); |
|
555 return EKeyWasConsumed; |
|
556 } |
|
557 if ( aType == EEventKey && aKeyEvent.iCode == EKeyOK ) |
|
558 { |
|
559 if ( ListBox()->Model()->NumberOfItems() ) |
|
560 { |
|
561 iMenuBar->SetMenuType(CEikMenuBar::EMenuContext); |
|
562 iMenuBar->TryDisplayContextMenuBarL(); |
|
563 } |
|
564 return EKeyWasConsumed; |
|
565 } |
|
566 if( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) |
|
567 { |
|
568 iExitCode = EEikCmdExit; |
|
569 TryExitL( EAknCmdExit ); |
|
570 return EKeyWasConsumed; |
|
571 } |
|
572 if( aType == EEventKeyUp ) |
|
573 { |
|
574 UpdateMskL( ); |
|
575 } |
|
576 |
|
577 // Exit if waitnote is cancelled & dismissed |
|
578 if ( iDialogDismissed && iEnumerationOperation ) |
|
579 { |
|
580 TryExitL( EAknSoftkeyBack ); |
|
581 iDialogDismissed = EFalse; |
|
582 return EKeyWasConsumed; |
|
583 } |
|
584 |
|
585 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
586 } |
|
587 |
|
588 |
|
589 // ---------------------------------------------------- |
|
590 // CSmsSimDialog::DynInitEditMenuL |
|
591 // ---------------------------------------------------- |
|
592 void CSmsSimDialog::DynInitEditMenuL( CEikMenuPane* aMenuPane ) |
|
593 { |
|
594 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DynInitEditMenuL(MEUPANE)"); |
|
595 CEikColumnListBox* listBox = ListBox(); |
|
596 |
|
597 // check what state item under "cursor" is |
|
598 const CListBoxView::CSelectionIndexArray* items = |
|
599 listBox->SelectionIndexes(); |
|
600 TKeyArrayFix key(0, ECmpTInt); |
|
601 TInt count = items->Count(); |
|
602 if ( 0 == count ) |
|
603 { |
|
604 //if no selection, disable unmarkall |
|
605 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmarkAll, ETrue ); |
|
606 } |
|
607 if ( count == listBox->Model()->NumberOfItems() ) |
|
608 { |
|
609 //if all selected, disable markall |
|
610 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMarkAll, ETrue ); |
|
611 } |
|
612 if(iContextCommand) |
|
613 { |
|
614 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMark, EFalse ); |
|
615 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmark, EFalse ); |
|
616 iContextCommand = EFalse; |
|
617 } |
|
618 else |
|
619 { |
|
620 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMark, ETrue ); |
|
621 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmark, ETrue ); |
|
622 } |
|
623 TInt pos; |
|
624 if ( !items->Find(listBox->CurrentItemIndex(), key, pos)) |
|
625 { |
|
626 aMenuPane->DeleteMenuItem( ESmsMtmUiCommandIdEditMark ); |
|
627 } |
|
628 else |
|
629 { |
|
630 aMenuPane->DeleteMenuItem( ESmsMtmUiCommandIdEditUnmark ); |
|
631 } |
|
632 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DynInitEditMenuL(MEUPANE)"); |
|
633 } |
|
634 |
|
635 // ---------------------------------------------------- |
|
636 // CSmsSimDialog::HandleListBoxEventL |
|
637 // ---------------------------------------------------- |
|
638 void CSmsSimDialog::HandleListBoxEventL( |
|
639 CEikListBox* /*aListBox*/, |
|
640 TListBoxEvent aEventType ) |
|
641 { |
|
642 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleListBoxEventL"); |
|
643 switch(aEventType) |
|
644 { |
|
645 case EEventEnterKeyPressed: |
|
646 case EEventItemSingleClicked: |
|
647 iContextCommand = ETrue; |
|
648 TryExitL( EAknSoftkeyContextOptions ); |
|
649 break; |
|
650 default: |
|
651 break; |
|
652 } |
|
653 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleListBoxEventL"); |
|
654 } |
|
655 |
|
656 // ---------------------------------------------------- |
|
657 // CSmsSimDialog::DeleteSimFolderL |
|
658 // ---------------------------------------------------- |
|
659 void CSmsSimDialog::DeleteSimFolderL() |
|
660 { |
|
661 if ( iSimFolderId != KMsvNullIndexEntryId ) |
|
662 { |
|
663 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DeleteSimFolderL"); |
|
664 CMsvEntry* entry = iSession.GetEntryL(iSimFolderId); |
|
665 CleanupStack::PushL(entry); |
|
666 TMsvSelectionOrdering ordering = entry->SortType(); |
|
667 ordering.SetShowInvisibleEntries( ETrue ); |
|
668 entry->SetSortTypeL( ordering ); |
|
669 entry->SetEntryL( entry->OwningService() ); // now entry points to SMS service |
|
670 CAknInputBlock::NewLC(); |
|
671 CMuiuOperationWait* waiter = |
|
672 CMuiuOperationWait::NewLC(); |
|
673 CMsvOperation* deleteOperation = |
|
674 entry->DeleteL(iSimFolderId, waiter->iStatus); |
|
675 waiter->Start(); |
|
676 delete deleteOperation; |
|
677 CleanupStack::PopAndDestroy(3, entry); // entry, waiter, CAknInputBlock |
|
678 iSimFolderId = KMsvNullIndexEntryId; |
|
679 } |
|
680 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DeleteSimFolderL"); |
|
681 } |
|
682 |
|
683 |
|
684 |
|
685 // ---------------------------------------------------- |
|
686 // CSmsSimDialog::HandleCopyFromSimToLocalFolderL |
|
687 // ---------------------------------------------------- |
|
688 void CSmsSimDialog::HandleCopyFromSimToLocalFolderL() |
|
689 { |
|
690 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleCopyFromSimToLocalFolderL"); |
|
691 |
|
692 TMsvId destinationId = 0; |
|
693 HBufC* title = StringLoader::LoadLC(R_SMS_DEFAULT_SIM_DIALOG_COPY_MESSAGES, iCoeEnv); |
|
694 if ( !CMsgFolderSelectionDialog::SelectFolderL( destinationId, *title ) ) |
|
695 { |
|
696 CleanupStack::PopAndDestroy( title ); |
|
697 return; |
|
698 } |
|
699 |
|
700 CleanupStack::PopAndDestroy( title ); |
|
701 |
|
702 LaunchNoteAndOperationL( destinationId ); |
|
703 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleCopyFromSimToLocalFolderL"); |
|
704 } |
|
705 |
|
706 // ---------------------------------------------------- |
|
707 // CSmsSimDialog::CreateSelectionArrayLC |
|
708 // ---------------------------------------------------- |
|
709 CMsvEntrySelection* CSmsSimDialog::CreateSelectionArrayLC() |
|
710 { |
|
711 SMUMLOGGER_ENTERFN(" CSmsSimDialog::CreateSelectionArrayLC"); |
|
712 CEikColumnListBox* listBox = ListBox(); |
|
713 const TInt selectionCount = listBox->View()->SelectionIndexes()->Count(); |
|
714 |
|
715 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); |
|
716 CleanupStack::PushL( selection ); |
|
717 if ( selectionCount ) |
|
718 { |
|
719 // selected items |
|
720 const CListBoxView::CSelectionIndexArray* items = |
|
721 listBox->SelectionIndexes(); |
|
722 const TInt count = items->Count(); |
|
723 for ( TInt loop = 0; loop < count; loop++ ) |
|
724 { |
|
725 selection->AppendL( iMessages->EntryId( items->At( loop ) ) ); |
|
726 } |
|
727 } |
|
728 else |
|
729 { |
|
730 // item under cursor |
|
731 const TInt index = ListBox()->CurrentItemIndex(); |
|
732 selection->AppendL( iMessages->EntryId(index) ); |
|
733 } |
|
734 #ifdef _DEBUG |
|
735 const TInt count2 = selection->Count(); |
|
736 RDebug::Print(_L("CSmsSimDialog::CreateSelectionArrayLC: items %d"), |
|
737 count2 ); |
|
738 for ( TInt loop2 = 0; loop2 < count2; loop2++ ) |
|
739 { |
|
740 RDebug::Print(_L("item %d id %d"), |
|
741 loop2, selection->At( loop2 ) ); |
|
742 } |
|
743 #endif |
|
744 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::CreateSelectionArrayLC"); |
|
745 return selection; |
|
746 } |
|
747 |
|
748 // ---------------------------------------------------- |
|
749 // CSmsSimDialog::HandleDeleteFromSimL |
|
750 // ---------------------------------------------------- |
|
751 void CSmsSimDialog::HandleDeleteFromSimL() |
|
752 { |
|
753 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleDeleteFromSimL"); |
|
754 HBufC* messageText = NULL; |
|
755 const TInt messageCount = ListBox()->View()->SelectionIndexes()->Count(); |
|
756 if ( messageCount == 1 || messageCount == 0 ) |
|
757 { |
|
758 messageText = StringLoader::LoadL( |
|
759 R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION_ONE_MESSAGE, iCoeEnv); |
|
760 } |
|
761 else |
|
762 { |
|
763 messageText = StringLoader::LoadL( |
|
764 R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION_MANY_MESSAGES, |
|
765 messageCount, |
|
766 iCoeEnv); |
|
767 } |
|
768 CleanupStack::PushL( messageText ); |
|
769 CAknQueryDialog* confDialog = CAknQueryDialog::NewL( ); |
|
770 if ( !confDialog->ExecuteLD( R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION, *messageText ) ) |
|
771 { |
|
772 CleanupStack::PopAndDestroy( messageText ); |
|
773 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleDeleteFromSimL - 1"); |
|
774 return; |
|
775 } |
|
776 CleanupStack::PopAndDestroy( messageText ); |
|
777 |
|
778 LaunchNoteAndOperationL(); |
|
779 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleDeleteFromSimL - 2"); |
|
780 } |
|
781 |
|
782 // ---------------------------------------------------- |
|
783 // CSmsSimDialog::UpdateSimMessagesArrayL |
|
784 // ---------------------------------------------------- |
|
785 void CSmsSimDialog::UpdateSimMessagesArrayL() |
|
786 { |
|
787 SMUMLOGGER_ENTERFN(" CSmsSimDialog::UpdateSimMessagesArrayL"); |
|
788 const TInt index = ListBox()->CurrentItemIndex(); |
|
789 iMessages->RefreshArrayL( iSimFolderId ); |
|
790 |
|
791 ListBox()->View()->ClearSelection(); |
|
792 const TInt count = iMessages->MdcaCount(); |
|
793 if ( iMsgCountBeforeOperation < count ) |
|
794 { // msg count increased |
|
795 ListBox()->HandleItemAdditionL(); |
|
796 } |
|
797 else if ( iMsgCountBeforeOperation > count ) |
|
798 { // msg count decreased |
|
799 if ( index == KErrNotFound && count ) |
|
800 { |
|
801 ListBox()->SetCurrentItemIndex( count - 1 ); |
|
802 } |
|
803 ListBox()->HandleItemRemovalL(); |
|
804 } |
|
805 |
|
806 // update msg count |
|
807 iMsgCountBeforeOperation = iMessages->MdcaCount(); |
|
808 UpdateMskL(); |
|
809 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::UpdateSimMessagesArrayL"); |
|
810 } |
|
811 |
|
812 // ---------------------------------------------------- |
|
813 // CSmsSimDialog::ListBox |
|
814 // ---------------------------------------------------- |
|
815 CEikColumnListBox* CSmsSimDialog::ListBox() const |
|
816 { |
|
817 return((CEikColumnListBox*)Control(EMsgControlIdSimMessageListBox)); |
|
818 } |
|
819 |
|
820 // ---------------------------------------------------- |
|
821 // CSmsSimDialog::EnumerateSimMessagesL |
|
822 // ---------------------------------------------------- |
|
823 void CSmsSimDialog::EnumerateSimMessagesL() |
|
824 { |
|
825 SMUMLOGGER_ENTERFN(" CSmsSimDialog::EnumerateSimMessagesL"); |
|
826 delete iWaitDialog; |
|
827 iWaitDialog = NULL; |
|
828 iWaitDialog = new (ELeave) CAknWaitDialog( |
|
829 (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), |
|
830 ETrue |
|
831 ); |
|
832 CleanupStack::PushL(TCleanupItem(CleanupWaitDialog, |
|
833 (TAny**)&iWaitDialog)); |
|
834 iWaitDialog->SetCallback( this ); |
|
835 iWaitDialog->ExecuteLD( R_DEFAULT_SIM_DIALOG_WAIT_NOTE ); |
|
836 |
|
837 // Find the service entry |
|
838 CMsvEntry* serviceEntry = iSession.GetEntryL(KMsvRootIndexEntryId); |
|
839 CleanupStack::PushL(serviceEntry); |
|
840 TMsvId serviceId; |
|
841 TSmsUtilities::ServiceIdL(*serviceEntry, serviceId, KUidMsgTypeSMS); |
|
842 |
|
843 // Enumerate sim messages |
|
844 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); |
|
845 CleanupStack::PushL(selection); |
|
846 selection->AppendL(serviceId); |
|
847 |
|
848 CMsvSingleOpWatcher* singleOpWatcher=CMsvSingleOpWatcher::NewL( *this ); |
|
849 CleanupStack::PushL(singleOpWatcher); |
|
850 TBuf8<1> foo (KNullDesC8); |
|
851 CAknInputBlock::NewLC(); // no need to store the pointer returned, It's on the Cleanup Stack |
|
852 CMsvOperation* operation = iSmsMtmUi.BaseMtm().InvokeAsyncFunctionL( |
|
853 ESmsMtmCommandEnumeratePhoneStores, |
|
854 *selection, |
|
855 foo, |
|
856 singleOpWatcher->iStatus); |
|
857 singleOpWatcher->SetOperation( operation ); |
|
858 iEnumerationOperation = singleOpWatcher; |
|
859 CleanupStack::PopAndDestroy(); // CAknInputBlock |
|
860 CleanupStack::Pop( singleOpWatcher ); |
|
861 CleanupStack::PopAndDestroy( 2, serviceEntry ); // serviceEntry, selection |
|
862 CleanupStack::Pop(); // TCleanupItem - everything ok so don't delete iWaitDialog |
|
863 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::EnumerateSimMessagesL"); |
|
864 } |
|
865 |
|
866 |
|
867 // ---------------------------------------------------- |
|
868 // CSmsSimDialog::StoreTitleTextAndSetNewL |
|
869 // ---------------------------------------------------- |
|
870 void CSmsSimDialog::StoreTitleTextAndSetNewL() |
|
871 { |
|
872 SMUMLOGGER_ENTERFN(" CSmsSimDialog::StoreTitleTextAndSetNewL"); |
|
873 CEikStatusPane* sp = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi()) |
|
874 ->StatusPane(); |
|
875 // Fetch pointer to the default title pane control |
|
876 CAknTitlePane* title=(CAknTitlePane *)sp->ControlL( |
|
877 TUid::Uid(EEikStatusPaneUidTitle)); |
|
878 |
|
879 delete iOldTitleText; |
|
880 iOldTitleText = NULL; |
|
881 iOldTitleText = HBufC::NewL( title->Text()->Length() + 1 ); |
|
882 TPtr tempText = iOldTitleText->Des(); |
|
883 tempText.Copy( (*title->Text()) ); |
|
884 |
|
885 HBufC* newTitle = StringLoader::LoadLC( |
|
886 R_SMS_DEFAULT_SIM_DIALOG_TITLE_TEXT, |
|
887 iCoeEnv ); |
|
888 title->SetTextL( *newTitle ); |
|
889 CleanupStack::PopAndDestroy( newTitle ); |
|
890 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::StoreTitleTextAndSetNewL"); |
|
891 } |
|
892 |
|
893 // ---------------------------------------------------- |
|
894 // CSmsSimDialog::RestoreTitleTextL |
|
895 // ---------------------------------------------------- |
|
896 void CSmsSimDialog::RestoreTitleTextL() |
|
897 { |
|
898 SMUMLOGGER_ENTERFN(" CSmsSimDialog::RestoreTitleTextL"); |
|
899 CEikStatusPane* sp = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi()) |
|
900 ->StatusPane(); |
|
901 // Fetch pointer to the default title pane control |
|
902 CAknTitlePane* title=(CAknTitlePane *)sp->ControlL( |
|
903 TUid::Uid(EEikStatusPaneUidTitle)); |
|
904 |
|
905 title->SetTextL( iOldTitleText->Des() ); |
|
906 delete iOldTitleText; |
|
907 iOldTitleText = NULL; |
|
908 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::RestoreTitleTextL"); |
|
909 } |
|
910 |
|
911 // ---------------------------------------------------- |
|
912 // CSmsSimDialog::OpCompleted |
|
913 // ---------------------------------------------------- |
|
914 void CSmsSimDialog::OpCompleted( |
|
915 CMsvSingleOpWatcher& aOpWatcher, |
|
916 TInt aCompletionCode ) |
|
917 { |
|
918 SMUMLOGGER_ENTERFN(" CSmsSimDialog::OpCompleted"); |
|
919 TBool tryToExit = EFalse; |
|
920 CMsvOperation* op=&aOpWatcher.Operation(); |
|
921 TRAP_IGNORE( tryToExit = DoOperationCompletedL(op, aCompletionCode ) ); |
|
922 if ( tryToExit ) |
|
923 { |
|
924 return; |
|
925 } |
|
926 |
|
927 if ( iEnumerationOperation->Operation().Id()==op->Id() ) |
|
928 { |
|
929 #ifdef _DEBUG |
|
930 RDebug::Print(_L("CSmsSimDialog::OpCompleted, completed enumerate operation") ); |
|
931 #endif |
|
932 delete iEnumerationOperation; |
|
933 iEnumerationOperation = NULL; |
|
934 } |
|
935 else if ( iCopyOrDeleteOperation->Operation().Id()==op->Id() ) |
|
936 { |
|
937 #ifdef _DEBUG |
|
938 RDebug::Print(_L("CSmsSimDialog::OpCompleted, completed copy/delete operation") ); |
|
939 #endif |
|
940 delete iCopyOrDeleteOperation; |
|
941 iCopyOrDeleteOperation = NULL; |
|
942 delete iProgressDialog; |
|
943 iProgressDialog = NULL; |
|
944 } |
|
945 |
|
946 if ( !iEnumerationOperation && !iCopyOrDeleteOperation ) |
|
947 { |
|
948 delete iWaitDialog; |
|
949 iWaitDialog = NULL; |
|
950 delete iProgressDialog; |
|
951 iProgressDialog = NULL; |
|
952 } |
|
953 ListBox()->DrawDeferred(); |
|
954 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::OpCompleted"); |
|
955 } |
|
956 |
|
957 // ---------------------------------------------------- |
|
958 // CSmsSimDialog::DoOperationCompletedL |
|
959 // ---------------------------------------------------- |
|
960 TBool CSmsSimDialog::DoOperationCompletedL( |
|
961 CMsvOperation* aOperation, |
|
962 TInt /*aCompletionCode*/ ) |
|
963 { |
|
964 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DoOperationCompletedL"); |
|
965 if ( !aOperation ) |
|
966 { |
|
967 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - FALSE -0"); |
|
968 return EFalse; |
|
969 } |
|
970 |
|
971 TSmsProgressBuf progressBuf; |
|
972 progressBuf.Copy(aOperation->ProgressL()); |
|
973 TSmsProgress progress = progressBuf(); |
|
974 iSmsMtmUi.DisplayProgressSummary(progressBuf); |
|
975 if ( iEnumerationOperation ) |
|
976 { |
|
977 #ifdef _DEBUG |
|
978 RDebug::Print(_L("CSmsSimDialog::DoOperationCompletedL, enumeration completed %d"), progress.iError ); |
|
979 #endif |
|
980 if ( !progress.iError) |
|
981 { |
|
982 iSimFolderId = progress.iEnumerateFolder; |
|
983 UpdateSimMessagesArrayL(); |
|
984 } |
|
985 else |
|
986 { |
|
987 delete iWaitDialog; |
|
988 iWaitDialog = NULL; |
|
989 TryExitL( EAknSoftkeyBack ); |
|
990 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - TRUE"); |
|
991 return ETrue; |
|
992 } |
|
993 } |
|
994 |
|
995 if ( iCopyOrDeleteOperation ) |
|
996 { |
|
997 #ifdef _DEBUG |
|
998 RDebug::Print(_L("CSmsSimDialog::DoOperationCompletedL, delete/copy completed %d"), progress.iError ); |
|
999 #endif |
|
1000 EnumerateSimMessagesL(); |
|
1001 } |
|
1002 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - FALSE"); |
|
1003 return EFalse; |
|
1004 } |
|
1005 |
|
1006 // ---------------------------------------------------- |
|
1007 // CSmsSimDialog::CleanupWaitDialog |
|
1008 // ---------------------------------------------------- |
|
1009 void CSmsSimDialog::CleanupWaitDialog(TAny* aAny) |
|
1010 { |
|
1011 SMUMLOGGER_ENTERFN(" CSmsSimDialog::CleanupWaitDialog"); |
|
1012 CEikDialog** dialog = (CEikDialog**) aAny; |
|
1013 if (dialog && *dialog) |
|
1014 { |
|
1015 delete *dialog; |
|
1016 *dialog = NULL; |
|
1017 } |
|
1018 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::CleanupWaitDialog"); |
|
1019 } |
|
1020 |
|
1021 // ---------------------------------------------------- |
|
1022 // CSmsSimDialog::DialogDismissedL |
|
1023 // ---------------------------------------------------- |
|
1024 void CSmsSimDialog::DialogDismissedL( TInt /*aButtonId*/ ) |
|
1025 { |
|
1026 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DialogDismissedL"); |
|
1027 if ( iEnumerationOperation ) |
|
1028 { |
|
1029 #ifdef _DEBUG |
|
1030 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, cancelling enumerate operation") ); |
|
1031 #endif |
|
1032 iDialogDismissed = ETrue; |
|
1033 } |
|
1034 else if ( iCopyOrDeleteOperation ) |
|
1035 { |
|
1036 #ifdef _DEBUG |
|
1037 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, cancelling copy or delete operation") ); |
|
1038 #endif |
|
1039 CSimDeleteCopyOperation* oper = STATIC_CAST(CSimDeleteCopyOperation*, &iCopyOrDeleteOperation->Operation()); |
|
1040 oper->CancelAfterCurrentCompleted(); |
|
1041 } |
|
1042 #ifdef _DEBUG |
|
1043 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, finish") ); |
|
1044 #endif |
|
1045 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DialogDismissedL"); |
|
1046 } |
|
1047 |
|
1048 // ---------------------------------------------------- |
|
1049 // CSmumMainSettingsDialog::LaunchHelpL |
|
1050 // launch help using context |
|
1051 // |
|
1052 // ---------------------------------------------------- |
|
1053 void CSmsSimDialog::LaunchHelpL() |
|
1054 { |
|
1055 SMUMLOGGER_ENTERFN(" CSmsSimDialog::LaunchHelpL"); |
|
1056 if ( iHelpFeatureSupported ) |
|
1057 { |
|
1058 CCoeAppUi* editorAppUi = STATIC_CAST(CCoeAppUi*, ControlEnv()->AppUi()); |
|
1059 CArrayFix<TCoeHelpContext>* helpContext = editorAppUi->AppHelpContextL(); |
|
1060 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
1061 } |
|
1062 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::LaunchHelpL"); |
|
1063 } |
|
1064 |
|
1065 |
|
1066 // ---------------------------------------------------- |
|
1067 // CSmumMainSettingsDialog::GetHelpContext |
|
1068 // returns helpcontext as aContext |
|
1069 // |
|
1070 // ---------------------------------------------------- |
|
1071 void CSmsSimDialog::GetHelpContext |
|
1072 (TCoeHelpContext& aContext) const |
|
1073 { |
|
1074 const TUid KUidMce ={0x100058C5}; |
|
1075 aContext.iMajor = KUidMce; |
|
1076 aContext.iContext = KMCE_HLP_SIM; |
|
1077 } |
|
1078 |
|
1079 // ---------------------------------------------------- |
|
1080 // CSmsSimDialog::LaunchNoteAndOperationL |
|
1081 // ---------------------------------------------------- |
|
1082 void CSmsSimDialog::LaunchNoteAndOperationL( TMsvId aDestinationId ) |
|
1083 { |
|
1084 SMUMLOGGER_ENTERFN(" CSmsSimDialog::LaunchNoteAndOperationL"); |
|
1085 // store msg count before operation |
|
1086 iMsgCountBeforeOperation = iMessages->MdcaCount(); |
|
1087 |
|
1088 delete iProgressDialog; |
|
1089 iProgressDialog = NULL; |
|
1090 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
1091 (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)), |
|
1092 ETrue |
|
1093 ); |
|
1094 CleanupStack::PushL(TCleanupItem(CleanupWaitDialog, |
|
1095 (TAny**)&iProgressDialog)); |
|
1096 iProgressDialog->SetCallback( this ); |
|
1097 CEikImage* icon = NULL; |
|
1098 icon = new (ELeave) CEikImage; |
|
1099 CleanupStack::PushL(icon); |
|
1100 TFileName fileName = AknIconUtils::AvkonIconFileName(); //avkon.mbm file name and path |
|
1101 |
|
1102 //select which icon to show |
|
1103 const TInt bitmapIndex = aDestinationId ? |
|
1104 EMbmAvkonQgn_note_copy : EMbmAvkonQgn_note_erased; |
|
1105 const TInt maskIndex = aDestinationId ? |
|
1106 EMbmAvkonQgn_note_copy_mask : EMbmAvkonQgn_note_erased_mask; |
|
1107 |
|
1108 const TAknsItemID id = aDestinationId ? |
|
1109 KAknsIIDQgnNoteCopy : KAknsIIDQgnNoteErased; |
|
1110 |
|
1111 CFbsBitmap* targetBitmap; |
|
1112 CFbsBitmap* targetBitmapMask; |
|
1113 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id , targetBitmap, |
|
1114 targetBitmapMask, fileName, bitmapIndex, maskIndex ); |
|
1115 |
|
1116 //set icon |
|
1117 icon->SetPicture(targetBitmap, targetBitmapMask); |
|
1118 iProgressDialog->SetImageL(icon); |
|
1119 CleanupStack::Pop(); // icon |
|
1120 iProgressDialog->ExecuteLD( R_DEFAULT_SIM_DIALOG_PROGRESS_NOTE ); |
|
1121 |
|
1122 CMsvEntrySelection* selection = CreateSelectionArrayLC(); |
|
1123 CAknInputBlock::NewLC(); // no need to store the pointer returned, It's on the Cleanup Stack |
|
1124 CMsvSingleOpWatcher* singleOpWatcher=CMsvSingleOpWatcher::NewL( *this ); |
|
1125 CleanupStack::PushL(singleOpWatcher); |
|
1126 |
|
1127 CMsvOperation* operation = NULL; |
|
1128 if ( aDestinationId ) |
|
1129 { // copy operation |
|
1130 operation = CSimDeleteCopyOperation::NewL( |
|
1131 iSession, |
|
1132 iSmsMtmUi, |
|
1133 singleOpWatcher->iStatus, |
|
1134 selection, |
|
1135 aDestinationId, |
|
1136 *iProgressDialog, |
|
1137 iCoeEnv ); |
|
1138 } |
|
1139 else |
|
1140 { // delete operation |
|
1141 operation = CSimDeleteCopyOperation::NewL( |
|
1142 iSession, |
|
1143 iSmsMtmUi, |
|
1144 singleOpWatcher->iStatus, |
|
1145 selection, |
|
1146 *iProgressDialog, |
|
1147 iCoeEnv ); |
|
1148 } |
|
1149 |
|
1150 singleOpWatcher->SetOperation( operation ); |
|
1151 iCopyOrDeleteOperation = singleOpWatcher; |
|
1152 CleanupStack::Pop( singleOpWatcher ); |
|
1153 CleanupStack::PopAndDestroy( 2, selection ); // CAknInputBlock |
|
1154 CleanupStack::Pop( ); // CleanupWaitDialog |
|
1155 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::LaunchNoteAndOperationL"); |
|
1156 } |
|
1157 |
|
1158 // ---------------------------------------------------- |
|
1159 // CSmsSimDialog::UpdateMskL |
|
1160 // ---------------------------------------------------- |
|
1161 void CSmsSimDialog::UpdateMskL() |
|
1162 { |
|
1163 SMUMLOGGER_ENTERFN(" CSmsSimDialog::UpdateMskL"); |
|
1164 TInt resId = 0; |
|
1165 const TInt KMskPosition = 3; |
|
1166 |
|
1167 if( ListBox()->Model()->NumberOfItems() == 0 ) |
|
1168 {//show empty button |
|
1169 resId = R_DEFAULT_SIM_MSK_BUTTON_EMPTY; |
|
1170 } |
|
1171 else |
|
1172 { |
|
1173 resId = R_DEFAULT_SIM_MSK_BUTTON_CONTEXTMENU; |
|
1174 } |
|
1175 |
|
1176 CEikButtonGroupContainer &cba = ButtonGroupContainer(); |
|
1177 cba.SetCommandL( KMskPosition, resId ); |
|
1178 cba.DrawDeferred(); |
|
1179 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::UpdateMskL"); |
|
1180 } |
|
1181 // End of File |