|
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 == EEventKeyUp ) |
|
567 { |
|
568 UpdateMskL( ); |
|
569 } |
|
570 |
|
571 // Exit if waitnote is cancelled & dismissed |
|
572 if ( iDialogDismissed && iEnumerationOperation ) |
|
573 { |
|
574 TryExitL( EAknSoftkeyBack ); |
|
575 iDialogDismissed = EFalse; |
|
576 return EKeyWasConsumed; |
|
577 } |
|
578 |
|
579 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
580 } |
|
581 |
|
582 |
|
583 // ---------------------------------------------------- |
|
584 // CSmsSimDialog::DynInitEditMenuL |
|
585 // ---------------------------------------------------- |
|
586 void CSmsSimDialog::DynInitEditMenuL( CEikMenuPane* aMenuPane ) |
|
587 { |
|
588 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DynInitEditMenuL(MEUPANE)"); |
|
589 CEikColumnListBox* listBox = ListBox(); |
|
590 |
|
591 // check what state item under "cursor" is |
|
592 const CListBoxView::CSelectionIndexArray* items = |
|
593 listBox->SelectionIndexes(); |
|
594 TKeyArrayFix key(0, ECmpTInt); |
|
595 TInt count = items->Count(); |
|
596 if ( 0 == count ) |
|
597 { |
|
598 //if no selection, disable unmarkall |
|
599 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmarkAll, ETrue ); |
|
600 } |
|
601 if ( count == listBox->Model()->NumberOfItems() ) |
|
602 { |
|
603 //if all selected, disable markall |
|
604 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMarkAll, ETrue ); |
|
605 } |
|
606 if(iContextCommand) |
|
607 { |
|
608 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMark, EFalse ); |
|
609 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmark, EFalse ); |
|
610 iContextCommand = EFalse; |
|
611 } |
|
612 else |
|
613 { |
|
614 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditMark, ETrue ); |
|
615 aMenuPane->SetItemDimmed( ESmsMtmUiCommandIdEditUnmark, ETrue ); |
|
616 } |
|
617 TInt pos; |
|
618 if ( !items->Find(listBox->CurrentItemIndex(), key, pos)) |
|
619 { |
|
620 aMenuPane->DeleteMenuItem( ESmsMtmUiCommandIdEditMark ); |
|
621 } |
|
622 else |
|
623 { |
|
624 aMenuPane->DeleteMenuItem( ESmsMtmUiCommandIdEditUnmark ); |
|
625 } |
|
626 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DynInitEditMenuL(MEUPANE)"); |
|
627 } |
|
628 |
|
629 // ---------------------------------------------------- |
|
630 // CSmsSimDialog::HandleListBoxEventL |
|
631 // ---------------------------------------------------- |
|
632 void CSmsSimDialog::HandleListBoxEventL( |
|
633 CEikListBox* /*aListBox*/, |
|
634 TListBoxEvent aEventType ) |
|
635 { |
|
636 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleListBoxEventL"); |
|
637 switch(aEventType) |
|
638 { |
|
639 case EEventEnterKeyPressed: |
|
640 case EEventItemSingleClicked: |
|
641 iContextCommand = ETrue; |
|
642 TryExitL( EAknSoftkeyContextOptions ); |
|
643 break; |
|
644 default: |
|
645 break; |
|
646 } |
|
647 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleListBoxEventL"); |
|
648 } |
|
649 |
|
650 // ---------------------------------------------------- |
|
651 // CSmsSimDialog::DeleteSimFolderL |
|
652 // ---------------------------------------------------- |
|
653 void CSmsSimDialog::DeleteSimFolderL() |
|
654 { |
|
655 if ( iSimFolderId != KMsvNullIndexEntryId ) |
|
656 { |
|
657 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DeleteSimFolderL"); |
|
658 CMsvEntry* entry = iSession.GetEntryL(iSimFolderId); |
|
659 CleanupStack::PushL(entry); |
|
660 TMsvSelectionOrdering ordering = entry->SortType(); |
|
661 ordering.SetShowInvisibleEntries( ETrue ); |
|
662 entry->SetSortTypeL( ordering ); |
|
663 entry->SetEntryL( entry->OwningService() ); // now entry points to SMS service |
|
664 CAknInputBlock::NewLC(); |
|
665 CMuiuOperationWait* waiter = |
|
666 CMuiuOperationWait::NewLC(); |
|
667 CMsvOperation* deleteOperation = |
|
668 entry->DeleteL(iSimFolderId, waiter->iStatus); |
|
669 waiter->Start(); |
|
670 delete deleteOperation; |
|
671 CleanupStack::PopAndDestroy(3, entry); // entry, waiter, CAknInputBlock |
|
672 iSimFolderId = KMsvNullIndexEntryId; |
|
673 } |
|
674 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DeleteSimFolderL"); |
|
675 } |
|
676 |
|
677 |
|
678 |
|
679 // ---------------------------------------------------- |
|
680 // CSmsSimDialog::HandleCopyFromSimToLocalFolderL |
|
681 // ---------------------------------------------------- |
|
682 void CSmsSimDialog::HandleCopyFromSimToLocalFolderL() |
|
683 { |
|
684 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleCopyFromSimToLocalFolderL"); |
|
685 |
|
686 TMsvId destinationId = 0; |
|
687 HBufC* title = StringLoader::LoadLC(R_SMS_DEFAULT_SIM_DIALOG_COPY_MESSAGES, iCoeEnv); |
|
688 if ( !CMsgFolderSelectionDialog::SelectFolderL( destinationId, *title ) ) |
|
689 { |
|
690 CleanupStack::PopAndDestroy( title ); |
|
691 return; |
|
692 } |
|
693 |
|
694 CleanupStack::PopAndDestroy( title ); |
|
695 |
|
696 LaunchNoteAndOperationL( destinationId ); |
|
697 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleCopyFromSimToLocalFolderL"); |
|
698 } |
|
699 |
|
700 // ---------------------------------------------------- |
|
701 // CSmsSimDialog::CreateSelectionArrayLC |
|
702 // ---------------------------------------------------- |
|
703 CMsvEntrySelection* CSmsSimDialog::CreateSelectionArrayLC() |
|
704 { |
|
705 SMUMLOGGER_ENTERFN(" CSmsSimDialog::CreateSelectionArrayLC"); |
|
706 CEikColumnListBox* listBox = ListBox(); |
|
707 const TInt selectionCount = listBox->View()->SelectionIndexes()->Count(); |
|
708 |
|
709 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); |
|
710 CleanupStack::PushL( selection ); |
|
711 if ( selectionCount ) |
|
712 { |
|
713 // selected items |
|
714 const CListBoxView::CSelectionIndexArray* items = |
|
715 listBox->SelectionIndexes(); |
|
716 const TInt count = items->Count(); |
|
717 for ( TInt loop = 0; loop < count; loop++ ) |
|
718 { |
|
719 selection->AppendL( iMessages->EntryId( items->At( loop ) ) ); |
|
720 } |
|
721 } |
|
722 else |
|
723 { |
|
724 // item under cursor |
|
725 const TInt index = ListBox()->CurrentItemIndex(); |
|
726 selection->AppendL( iMessages->EntryId(index) ); |
|
727 } |
|
728 #ifdef _DEBUG |
|
729 const TInt count2 = selection->Count(); |
|
730 RDebug::Print(_L("CSmsSimDialog::CreateSelectionArrayLC: items %d"), |
|
731 count2 ); |
|
732 for ( TInt loop2 = 0; loop2 < count2; loop2++ ) |
|
733 { |
|
734 RDebug::Print(_L("item %d id %d"), |
|
735 loop2, selection->At( loop2 ) ); |
|
736 } |
|
737 #endif |
|
738 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::CreateSelectionArrayLC"); |
|
739 return selection; |
|
740 } |
|
741 |
|
742 // ---------------------------------------------------- |
|
743 // CSmsSimDialog::HandleDeleteFromSimL |
|
744 // ---------------------------------------------------- |
|
745 void CSmsSimDialog::HandleDeleteFromSimL() |
|
746 { |
|
747 SMUMLOGGER_ENTERFN(" CSmsSimDialog::HandleDeleteFromSimL"); |
|
748 HBufC* messageText = NULL; |
|
749 const TInt messageCount = ListBox()->View()->SelectionIndexes()->Count(); |
|
750 if ( messageCount == 1 || messageCount == 0 ) |
|
751 { |
|
752 messageText = StringLoader::LoadL( |
|
753 R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION_ONE_MESSAGE, iCoeEnv); |
|
754 } |
|
755 else |
|
756 { |
|
757 messageText = StringLoader::LoadL( |
|
758 R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION_MANY_MESSAGES, |
|
759 messageCount, |
|
760 iCoeEnv); |
|
761 } |
|
762 CleanupStack::PushL( messageText ); |
|
763 CAknQueryDialog* confDialog = CAknQueryDialog::NewL( ); |
|
764 if ( !confDialog->ExecuteLD( R_DEFAULT_SIM_MESSAGE_DELETE_CONFIRMATION, *messageText ) ) |
|
765 { |
|
766 CleanupStack::PopAndDestroy( messageText ); |
|
767 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleDeleteFromSimL - 1"); |
|
768 return; |
|
769 } |
|
770 CleanupStack::PopAndDestroy( messageText ); |
|
771 |
|
772 LaunchNoteAndOperationL(); |
|
773 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::HandleDeleteFromSimL - 2"); |
|
774 } |
|
775 |
|
776 // ---------------------------------------------------- |
|
777 // CSmsSimDialog::UpdateSimMessagesArrayL |
|
778 // ---------------------------------------------------- |
|
779 void CSmsSimDialog::UpdateSimMessagesArrayL() |
|
780 { |
|
781 SMUMLOGGER_ENTERFN(" CSmsSimDialog::UpdateSimMessagesArrayL"); |
|
782 const TInt index = ListBox()->CurrentItemIndex(); |
|
783 iMessages->RefreshArrayL( iSimFolderId ); |
|
784 |
|
785 ListBox()->View()->ClearSelection(); |
|
786 const TInt count = iMessages->MdcaCount(); |
|
787 if ( iMsgCountBeforeOperation < count ) |
|
788 { // msg count increased |
|
789 ListBox()->HandleItemAdditionL(); |
|
790 } |
|
791 else if ( iMsgCountBeforeOperation > count ) |
|
792 { // msg count decreased |
|
793 if ( index == KErrNotFound && count ) |
|
794 { |
|
795 ListBox()->SetCurrentItemIndex( count - 1 ); |
|
796 } |
|
797 ListBox()->HandleItemRemovalL(); |
|
798 } |
|
799 |
|
800 // update msg count |
|
801 iMsgCountBeforeOperation = iMessages->MdcaCount(); |
|
802 UpdateMskL(); |
|
803 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::UpdateSimMessagesArrayL"); |
|
804 } |
|
805 |
|
806 // ---------------------------------------------------- |
|
807 // CSmsSimDialog::ListBox |
|
808 // ---------------------------------------------------- |
|
809 CEikColumnListBox* CSmsSimDialog::ListBox() const |
|
810 { |
|
811 return((CEikColumnListBox*)Control(EMsgControlIdSimMessageListBox)); |
|
812 } |
|
813 |
|
814 // ---------------------------------------------------- |
|
815 // CSmsSimDialog::EnumerateSimMessagesL |
|
816 // ---------------------------------------------------- |
|
817 void CSmsSimDialog::EnumerateSimMessagesL() |
|
818 { |
|
819 SMUMLOGGER_ENTERFN(" CSmsSimDialog::EnumerateSimMessagesL"); |
|
820 delete iWaitDialog; |
|
821 iWaitDialog = NULL; |
|
822 iWaitDialog = new (ELeave) CAknWaitDialog( |
|
823 (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), |
|
824 ETrue |
|
825 ); |
|
826 CleanupStack::PushL(TCleanupItem(CleanupWaitDialog, |
|
827 (TAny**)&iWaitDialog)); |
|
828 iWaitDialog->SetCallback( this ); |
|
829 iWaitDialog->ExecuteLD( R_DEFAULT_SIM_DIALOG_WAIT_NOTE ); |
|
830 |
|
831 // Find the service entry |
|
832 CMsvEntry* serviceEntry = iSession.GetEntryL(KMsvRootIndexEntryId); |
|
833 CleanupStack::PushL(serviceEntry); |
|
834 TMsvId serviceId; |
|
835 TSmsUtilities::ServiceIdL(*serviceEntry, serviceId, KUidMsgTypeSMS); |
|
836 |
|
837 // Enumerate sim messages |
|
838 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); |
|
839 CleanupStack::PushL(selection); |
|
840 selection->AppendL(serviceId); |
|
841 |
|
842 CMsvSingleOpWatcher* singleOpWatcher=CMsvSingleOpWatcher::NewL( *this ); |
|
843 CleanupStack::PushL(singleOpWatcher); |
|
844 TBuf8<1> foo (KNullDesC8); |
|
845 CAknInputBlock::NewLC(); // no need to store the pointer returned, It's on the Cleanup Stack |
|
846 CMsvOperation* operation = iSmsMtmUi.BaseMtm().InvokeAsyncFunctionL( |
|
847 ESmsMtmCommandEnumeratePhoneStores, |
|
848 *selection, |
|
849 foo, |
|
850 singleOpWatcher->iStatus); |
|
851 singleOpWatcher->SetOperation( operation ); |
|
852 iEnumerationOperation = singleOpWatcher; |
|
853 CleanupStack::PopAndDestroy(); // CAknInputBlock |
|
854 CleanupStack::Pop( singleOpWatcher ); |
|
855 CleanupStack::PopAndDestroy( 2, serviceEntry ); // serviceEntry, selection |
|
856 CleanupStack::Pop(); // TCleanupItem - everything ok so don't delete iWaitDialog |
|
857 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::EnumerateSimMessagesL"); |
|
858 } |
|
859 |
|
860 |
|
861 // ---------------------------------------------------- |
|
862 // CSmsSimDialog::StoreTitleTextAndSetNewL |
|
863 // ---------------------------------------------------- |
|
864 void CSmsSimDialog::StoreTitleTextAndSetNewL() |
|
865 { |
|
866 SMUMLOGGER_ENTERFN(" CSmsSimDialog::StoreTitleTextAndSetNewL"); |
|
867 CEikStatusPane* sp = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi()) |
|
868 ->StatusPane(); |
|
869 // Fetch pointer to the default title pane control |
|
870 CAknTitlePane* title=(CAknTitlePane *)sp->ControlL( |
|
871 TUid::Uid(EEikStatusPaneUidTitle)); |
|
872 |
|
873 delete iOldTitleText; |
|
874 iOldTitleText = NULL; |
|
875 iOldTitleText = HBufC::NewL( title->Text()->Length() + 1 ); |
|
876 TPtr tempText = iOldTitleText->Des(); |
|
877 tempText.Copy( (*title->Text()) ); |
|
878 |
|
879 HBufC* newTitle = StringLoader::LoadLC( |
|
880 R_SMS_DEFAULT_SIM_DIALOG_TITLE_TEXT, |
|
881 iCoeEnv ); |
|
882 title->SetTextL( *newTitle ); |
|
883 CleanupStack::PopAndDestroy( newTitle ); |
|
884 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::StoreTitleTextAndSetNewL"); |
|
885 } |
|
886 |
|
887 // ---------------------------------------------------- |
|
888 // CSmsSimDialog::RestoreTitleTextL |
|
889 // ---------------------------------------------------- |
|
890 void CSmsSimDialog::RestoreTitleTextL() |
|
891 { |
|
892 SMUMLOGGER_ENTERFN(" CSmsSimDialog::RestoreTitleTextL"); |
|
893 CEikStatusPane* sp = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi()) |
|
894 ->StatusPane(); |
|
895 // Fetch pointer to the default title pane control |
|
896 CAknTitlePane* title=(CAknTitlePane *)sp->ControlL( |
|
897 TUid::Uid(EEikStatusPaneUidTitle)); |
|
898 |
|
899 title->SetTextL( iOldTitleText->Des() ); |
|
900 delete iOldTitleText; |
|
901 iOldTitleText = NULL; |
|
902 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::RestoreTitleTextL"); |
|
903 } |
|
904 |
|
905 // ---------------------------------------------------- |
|
906 // CSmsSimDialog::OpCompleted |
|
907 // ---------------------------------------------------- |
|
908 void CSmsSimDialog::OpCompleted( |
|
909 CMsvSingleOpWatcher& aOpWatcher, |
|
910 TInt aCompletionCode ) |
|
911 { |
|
912 SMUMLOGGER_ENTERFN(" CSmsSimDialog::OpCompleted"); |
|
913 TBool tryToExit = EFalse; |
|
914 CMsvOperation* op=&aOpWatcher.Operation(); |
|
915 TRAP_IGNORE( tryToExit = DoOperationCompletedL(op, aCompletionCode ) ); |
|
916 if ( tryToExit ) |
|
917 { |
|
918 return; |
|
919 } |
|
920 |
|
921 if ( iEnumerationOperation->Operation().Id()==op->Id() ) |
|
922 { |
|
923 #ifdef _DEBUG |
|
924 RDebug::Print(_L("CSmsSimDialog::OpCompleted, completed enumerate operation") ); |
|
925 #endif |
|
926 delete iEnumerationOperation; |
|
927 iEnumerationOperation = NULL; |
|
928 } |
|
929 else if ( iCopyOrDeleteOperation->Operation().Id()==op->Id() ) |
|
930 { |
|
931 #ifdef _DEBUG |
|
932 RDebug::Print(_L("CSmsSimDialog::OpCompleted, completed copy/delete operation") ); |
|
933 #endif |
|
934 delete iCopyOrDeleteOperation; |
|
935 iCopyOrDeleteOperation = NULL; |
|
936 delete iProgressDialog; |
|
937 iProgressDialog = NULL; |
|
938 } |
|
939 |
|
940 if ( !iEnumerationOperation && !iCopyOrDeleteOperation ) |
|
941 { |
|
942 delete iWaitDialog; |
|
943 iWaitDialog = NULL; |
|
944 delete iProgressDialog; |
|
945 iProgressDialog = NULL; |
|
946 } |
|
947 ListBox()->DrawDeferred(); |
|
948 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::OpCompleted"); |
|
949 } |
|
950 |
|
951 // ---------------------------------------------------- |
|
952 // CSmsSimDialog::DoOperationCompletedL |
|
953 // ---------------------------------------------------- |
|
954 TBool CSmsSimDialog::DoOperationCompletedL( |
|
955 CMsvOperation* aOperation, |
|
956 TInt /*aCompletionCode*/ ) |
|
957 { |
|
958 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DoOperationCompletedL"); |
|
959 if ( !aOperation ) |
|
960 { |
|
961 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - FALSE -0"); |
|
962 return EFalse; |
|
963 } |
|
964 |
|
965 TSmsProgressBuf progressBuf; |
|
966 progressBuf.Copy(aOperation->ProgressL()); |
|
967 TSmsProgress progress = progressBuf(); |
|
968 iSmsMtmUi.DisplayProgressSummary(progressBuf); |
|
969 if ( iEnumerationOperation ) |
|
970 { |
|
971 #ifdef _DEBUG |
|
972 RDebug::Print(_L("CSmsSimDialog::DoOperationCompletedL, enumeration completed %d"), progress.iError ); |
|
973 #endif |
|
974 if ( !progress.iError) |
|
975 { |
|
976 iSimFolderId = progress.iEnumerateFolder; |
|
977 UpdateSimMessagesArrayL(); |
|
978 } |
|
979 else |
|
980 { |
|
981 delete iWaitDialog; |
|
982 iWaitDialog = NULL; |
|
983 TryExitL( EAknSoftkeyBack ); |
|
984 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - TRUE"); |
|
985 return ETrue; |
|
986 } |
|
987 } |
|
988 |
|
989 if ( iCopyOrDeleteOperation ) |
|
990 { |
|
991 #ifdef _DEBUG |
|
992 RDebug::Print(_L("CSmsSimDialog::DoOperationCompletedL, delete/copy completed %d"), progress.iError ); |
|
993 #endif |
|
994 EnumerateSimMessagesL(); |
|
995 } |
|
996 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DoOperationCompletedL - FALSE"); |
|
997 return EFalse; |
|
998 } |
|
999 |
|
1000 // ---------------------------------------------------- |
|
1001 // CSmsSimDialog::CleanupWaitDialog |
|
1002 // ---------------------------------------------------- |
|
1003 void CSmsSimDialog::CleanupWaitDialog(TAny* aAny) |
|
1004 { |
|
1005 SMUMLOGGER_ENTERFN(" CSmsSimDialog::CleanupWaitDialog"); |
|
1006 CEikDialog** dialog = (CEikDialog**) aAny; |
|
1007 if (dialog && *dialog) |
|
1008 { |
|
1009 delete *dialog; |
|
1010 *dialog = NULL; |
|
1011 } |
|
1012 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::CleanupWaitDialog"); |
|
1013 } |
|
1014 |
|
1015 // ---------------------------------------------------- |
|
1016 // CSmsSimDialog::DialogDismissedL |
|
1017 // ---------------------------------------------------- |
|
1018 void CSmsSimDialog::DialogDismissedL( TInt /*aButtonId*/ ) |
|
1019 { |
|
1020 SMUMLOGGER_ENTERFN(" CSmsSimDialog::DialogDismissedL"); |
|
1021 if ( iEnumerationOperation ) |
|
1022 { |
|
1023 #ifdef _DEBUG |
|
1024 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, cancelling enumerate operation") ); |
|
1025 #endif |
|
1026 iDialogDismissed = ETrue; |
|
1027 } |
|
1028 else if ( iCopyOrDeleteOperation ) |
|
1029 { |
|
1030 #ifdef _DEBUG |
|
1031 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, cancelling copy or delete operation") ); |
|
1032 #endif |
|
1033 CSimDeleteCopyOperation* oper = STATIC_CAST(CSimDeleteCopyOperation*, &iCopyOrDeleteOperation->Operation()); |
|
1034 oper->CancelAfterCurrentCompleted(); |
|
1035 } |
|
1036 #ifdef _DEBUG |
|
1037 RDebug::Print(_L("CSmsSimDialog::DialogDismissedL, finish") ); |
|
1038 #endif |
|
1039 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::DialogDismissedL"); |
|
1040 } |
|
1041 |
|
1042 // ---------------------------------------------------- |
|
1043 // CSmumMainSettingsDialog::LaunchHelpL |
|
1044 // launch help using context |
|
1045 // |
|
1046 // ---------------------------------------------------- |
|
1047 void CSmsSimDialog::LaunchHelpL() |
|
1048 { |
|
1049 SMUMLOGGER_ENTERFN(" CSmsSimDialog::LaunchHelpL"); |
|
1050 if ( iHelpFeatureSupported ) |
|
1051 { |
|
1052 CCoeAppUi* editorAppUi = STATIC_CAST(CCoeAppUi*, ControlEnv()->AppUi()); |
|
1053 CArrayFix<TCoeHelpContext>* helpContext = editorAppUi->AppHelpContextL(); |
|
1054 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
1055 } |
|
1056 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::LaunchHelpL"); |
|
1057 } |
|
1058 |
|
1059 |
|
1060 // ---------------------------------------------------- |
|
1061 // CSmumMainSettingsDialog::GetHelpContext |
|
1062 // returns helpcontext as aContext |
|
1063 // |
|
1064 // ---------------------------------------------------- |
|
1065 void CSmsSimDialog::GetHelpContext |
|
1066 (TCoeHelpContext& aContext) const |
|
1067 { |
|
1068 const TUid KUidMce ={0x100058C5}; |
|
1069 aContext.iMajor = KUidMce; |
|
1070 aContext.iContext = KMCE_HLP_SIM; |
|
1071 } |
|
1072 |
|
1073 // ---------------------------------------------------- |
|
1074 // CSmsSimDialog::LaunchNoteAndOperationL |
|
1075 // ---------------------------------------------------- |
|
1076 void CSmsSimDialog::LaunchNoteAndOperationL( TMsvId aDestinationId ) |
|
1077 { |
|
1078 SMUMLOGGER_ENTERFN(" CSmsSimDialog::LaunchNoteAndOperationL"); |
|
1079 // store msg count before operation |
|
1080 iMsgCountBeforeOperation = iMessages->MdcaCount(); |
|
1081 |
|
1082 delete iProgressDialog; |
|
1083 iProgressDialog = NULL; |
|
1084 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
1085 (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)), |
|
1086 ETrue |
|
1087 ); |
|
1088 CleanupStack::PushL(TCleanupItem(CleanupWaitDialog, |
|
1089 (TAny**)&iProgressDialog)); |
|
1090 iProgressDialog->SetCallback( this ); |
|
1091 CEikImage* icon = NULL; |
|
1092 icon = new (ELeave) CEikImage; |
|
1093 CleanupStack::PushL(icon); |
|
1094 TFileName fileName = AknIconUtils::AvkonIconFileName(); //avkon.mbm file name and path |
|
1095 |
|
1096 //select which icon to show |
|
1097 const TInt bitmapIndex = aDestinationId ? |
|
1098 EMbmAvkonQgn_note_copy : EMbmAvkonQgn_note_erased; |
|
1099 const TInt maskIndex = aDestinationId ? |
|
1100 EMbmAvkonQgn_note_copy_mask : EMbmAvkonQgn_note_erased_mask; |
|
1101 |
|
1102 const TAknsItemID id = aDestinationId ? |
|
1103 KAknsIIDQgnNoteCopy : KAknsIIDQgnNoteErased; |
|
1104 |
|
1105 CFbsBitmap* targetBitmap; |
|
1106 CFbsBitmap* targetBitmapMask; |
|
1107 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id , targetBitmap, |
|
1108 targetBitmapMask, fileName, bitmapIndex, maskIndex ); |
|
1109 |
|
1110 //set icon |
|
1111 icon->SetPicture(targetBitmap, targetBitmapMask); |
|
1112 iProgressDialog->SetImageL(icon); |
|
1113 CleanupStack::Pop(); // icon |
|
1114 iProgressDialog->ExecuteLD( R_DEFAULT_SIM_DIALOG_PROGRESS_NOTE ); |
|
1115 |
|
1116 CMsvEntrySelection* selection = CreateSelectionArrayLC(); |
|
1117 CAknInputBlock::NewLC(); // no need to store the pointer returned, It's on the Cleanup Stack |
|
1118 CMsvSingleOpWatcher* singleOpWatcher=CMsvSingleOpWatcher::NewL( *this ); |
|
1119 CleanupStack::PushL(singleOpWatcher); |
|
1120 |
|
1121 CMsvOperation* operation = NULL; |
|
1122 if ( aDestinationId ) |
|
1123 { // copy operation |
|
1124 operation = CSimDeleteCopyOperation::NewL( |
|
1125 iSession, |
|
1126 iSmsMtmUi, |
|
1127 singleOpWatcher->iStatus, |
|
1128 selection, |
|
1129 aDestinationId, |
|
1130 *iProgressDialog, |
|
1131 iCoeEnv ); |
|
1132 } |
|
1133 else |
|
1134 { // delete operation |
|
1135 operation = CSimDeleteCopyOperation::NewL( |
|
1136 iSession, |
|
1137 iSmsMtmUi, |
|
1138 singleOpWatcher->iStatus, |
|
1139 selection, |
|
1140 *iProgressDialog, |
|
1141 iCoeEnv ); |
|
1142 } |
|
1143 |
|
1144 singleOpWatcher->SetOperation( operation ); |
|
1145 iCopyOrDeleteOperation = singleOpWatcher; |
|
1146 CleanupStack::Pop( singleOpWatcher ); |
|
1147 CleanupStack::PopAndDestroy( 2, selection ); // CAknInputBlock |
|
1148 CleanupStack::Pop( ); // CleanupWaitDialog |
|
1149 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::LaunchNoteAndOperationL"); |
|
1150 } |
|
1151 |
|
1152 // ---------------------------------------------------- |
|
1153 // CSmsSimDialog::UpdateMskL |
|
1154 // ---------------------------------------------------- |
|
1155 void CSmsSimDialog::UpdateMskL() |
|
1156 { |
|
1157 SMUMLOGGER_ENTERFN(" CSmsSimDialog::UpdateMskL"); |
|
1158 TInt resId = 0; |
|
1159 const TInt KMskPosition = 3; |
|
1160 |
|
1161 if( ListBox()->Model()->NumberOfItems() == 0 ) |
|
1162 {//show empty button |
|
1163 resId = R_DEFAULT_SIM_MSK_BUTTON_EMPTY; |
|
1164 } |
|
1165 else |
|
1166 { |
|
1167 resId = R_DEFAULT_SIM_MSK_BUTTON_CONTEXTMENU; |
|
1168 } |
|
1169 |
|
1170 CEikButtonGroupContainer &cba = ButtonGroupContainer(); |
|
1171 cba.SetCommandL( KMskPosition, resId ); |
|
1172 cba.DrawDeferred(); |
|
1173 SMUMLOGGER_LEAVEFN(" CSmsSimDialog::UpdateMskL"); |
|
1174 } |
|
1175 // End of File |