branch | RCL_3 |
changeset 23 | 7be2816dbabd |
parent 0 | f72a12da539e |
19:79311d856354 | 23:7be2816dbabd |
---|---|
13 * |
13 * |
14 * Description: Add folder command |
14 * Description: Add folder command |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <liwcommon.h> |
19 #include <liwcommon.h> |
20 |
20 |
21 #include "mmmovetofoldercommand.h" |
21 #include "mmmovetofoldercommand.h" |
22 #include "hnglobals.h" |
22 #include "hnglobals.h" |
23 #include "menudebug.h" |
23 #include "menudebug.h" |
87 iOpenedHierarchy.Close(); |
87 iOpenedHierarchy.Close(); |
88 delete iServiceHandler; |
88 delete iServiceHandler; |
89 } |
89 } |
90 |
90 |
91 // --------------------------------------------------------------------------- |
91 // --------------------------------------------------------------------------- |
92 // |
92 // |
93 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
94 // |
94 // |
95 CMmMoveToFolderCommand::CMmMoveToFolderCommand() |
95 CMmMoveToFolderCommand::CMmMoveToFolderCommand() |
96 { |
96 { |
97 } |
97 } |
98 |
98 |
99 // --------------------------------------------------------------------------- |
99 // --------------------------------------------------------------------------- |
100 // |
100 // |
101 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
102 // |
102 // |
103 TInt CMmMoveToFolderCommand::HandleNotifyL( |
103 TInt CMmMoveToFolderCommand::HandleNotifyL( |
104 TInt /*aCmdId*/, |
104 TInt /*aCmdId*/, |
105 TInt aEventId, |
105 TInt aEventId, |
106 CLiwGenericParamList& /*aEventParamList*/, |
106 CLiwGenericParamList& /*aEventParamList*/, |
107 const CLiwGenericParamList& /*aInParamList*/ ) |
107 const CLiwGenericParamList& /*aInParamList*/ ) |
108 { |
108 { |
109 if (aEventId != KLiwEventCanceled) |
109 if (aEventId != KLiwEventCanceled) |
115 return KErrNone; |
115 return KErrNone; |
116 } |
116 } |
117 |
117 |
118 |
118 |
119 // --------------------------------------------------------------------------- |
119 // --------------------------------------------------------------------------- |
120 // |
120 // |
121 // --------------------------------------------------------------------------- |
121 // --------------------------------------------------------------------------- |
122 // |
122 // |
123 void CMmMoveToFolderCommand::ExecuteActionL( |
123 void CMmMoveToFolderCommand::ExecuteActionL( |
124 CLiwGenericParamList* aEventParamList ) |
124 CLiwGenericParamList* aEventParamList ) |
125 { |
125 { |
126 |
126 |
127 // |
127 // |
128 // Prepare move to folder operation |
128 // Prepare move to folder operation |
129 MMPERF(("CMmMoveToFolderCommand::ExecuteActionL - START")); |
129 MMPERF(("CMmMoveToFolderCommand::ExecuteActionL - START")); |
130 iItemId = GetIntL( *aEventParamList, KIdAttrName8 ); |
130 iItemId = GetIntL( *aEventParamList, KIdAttrName8 ); |
131 iParentId = GetIntL( *aEventParamList, KFolderAttrName8 ); |
131 iParentId = GetIntL( *aEventParamList, KFolderAttrName8 ); |
132 TPtrC widget = GetStringL( *aEventParamList, KWidgetAttrName8 ); |
132 TPtrC widget = GetStringL( *aEventParamList, KWidgetAttrName8 ); |
133 TPtrC currentTempName = GetStringL( *aEventParamList, KName8 ); |
133 TPtrC currentTempName = GetStringL( *aEventParamList, KName8 ); |
134 |
134 |
135 iItemName.Close(); |
135 iItemName.Close(); |
136 iItemName.CreateL( currentTempName ); |
136 iItemName.CreateL( currentTempName ); |
137 |
137 |
138 iWidgetType.Close(); |
138 iWidgetType.Close(); |
139 iWidgetType.CreateL( widget ); |
139 iWidgetType.CreateL( widget ); |
140 |
140 |
141 CMmFolder* rootFolder = CMmFolder::NewL(); |
141 CMmFolder* rootFolder = CMmFolder::NewL(); |
142 CleanupStack::PushL( rootFolder ); |
142 CleanupStack::PushL( rootFolder ); |
143 |
143 |
144 rootFolder->SetNameL( iSharedResources->GetRootFolder()); |
144 rootFolder->SetNameL( iSharedResources->GetRootFolder()); |
145 rootFolder->SetId( KRootId ); |
145 rootFolder->SetId( KRootId ); |
146 iOpenedHierarchy.AppendL( rootFolder ); |
146 iOpenedHierarchy.AppendL( rootFolder ); |
147 CleanupStack::Pop( rootFolder ); |
147 CleanupStack::Pop( rootFolder ); |
148 iLockDialog = EFalse; |
148 iLockDialog = EFalse; |
149 |
149 |
150 // Excute move to folder operation |
150 // Excute move to folder operation |
151 TInt err( KErrNone ); |
151 TInt err( KErrNone ); |
152 |
152 |
153 // Get folder list form MCS |
153 // Get folder list form MCS |
154 GetFolderListL( CurrentFolder()->Id() ); |
154 GetFolderListL( CurrentFolder()->Id() ); |
155 |
155 |
156 RPointerArray< CMmFolder > folders; |
156 RPointerArray< CMmFolder > folders; |
157 CleanupResetAndDestroyPushL( folders ); |
157 CleanupResetAndDestroyPushL( folders ); |
158 |
158 |
159 // Get folders from GetList output |
159 // Get folders from GetList output |
160 GetFoldersL(folders); |
160 GetFoldersL(folders); |
161 |
161 |
162 // if foler already exists, reopen options menu |
162 // if foler already exists, reopen options menu |
163 do |
163 do |
164 { |
164 { |
165 TRAP( err, ExecuteMoveToFolderL()); |
165 TRAP( err, ExecuteMoveToFolderL()); |
166 } |
166 } |
167 while ( err == KErrAlreadyExists && folders.Count() > 0 ); |
167 while ( err == KErrAlreadyExists && folders.Count() > 0 ); |
168 |
168 |
169 // if any different leave was trapped, pass it on |
169 // if any different leave was trapped, pass it on |
170 if ( err != KErrNone ) |
170 if ( err != KErrNone ) |
171 { |
171 { |
172 User::Leave( err ); |
172 User::Leave( err ); |
173 } |
173 } |
174 |
174 |
175 CleanupStack::PopAndDestroy( &folders ); |
175 CleanupStack::PopAndDestroy( &folders ); |
176 //MMPERF(("CFolderUiExtPlugin::AddFolderCommandL - END")); |
176 //MMPERF(("CFolderUiExtPlugin::AddFolderCommandL - END")); |
177 } |
177 } |
178 |
178 |
179 |
179 |
180 // --------------------------------------------------------------------------- |
180 // --------------------------------------------------------------------------- |
181 // |
181 // |
182 // --------------------------------------------------------------------------- |
182 // --------------------------------------------------------------------------- |
183 // |
183 // |
184 CMmFolder* CMmMoveToFolderCommand::CurrentFolder() |
184 CMmFolder* CMmMoveToFolderCommand::CurrentFolder() |
185 { |
185 { |
186 ASSERT( iOpenedHierarchy.Count() > 0 ); |
186 ASSERT( iOpenedHierarchy.Count() > 0 ); |
187 return iOpenedHierarchy[ iOpenedHierarchy.Count() - 1 ]; |
187 return iOpenedHierarchy[ iOpenedHierarchy.Count() - 1 ]; |
188 } |
188 } |
189 |
189 |
190 // --------------------------------------------------------------------------- |
190 // --------------------------------------------------------------------------- |
191 // |
191 // |
192 // --------------------------------------------------------------------------- |
192 // --------------------------------------------------------------------------- |
193 // |
193 // |
194 void CMmMoveToFolderCommand::MoveToFolderL( TInt aId, TInt aFolderId, |
194 void CMmMoveToFolderCommand::MoveToFolderL( TInt aId, TInt aFolderId, |
195 TInt aBeforeItemId ) |
195 TInt aBeforeItemId ) |
196 { |
196 { |
203 KIdsList, KKeyTypeList, KNullDesC8 ); |
203 KIdsList, KKeyTypeList, KNullDesC8 ); |
204 |
204 |
205 HBufC8* id = HnConvUtils::NumToStr8LC( aId ); |
205 HBufC8* id = HnConvUtils::NumToStr8LC( aId ); |
206 AddSubKeyL( listIds, KIdParam, KKeyTypeBoolean, *id ); |
206 AddSubKeyL( listIds, KIdParam, KKeyTypeBoolean, *id ); |
207 CleanupStack::PopAndDestroy(); |
207 CleanupStack::PopAndDestroy(); |
208 |
208 |
209 inDataKey->AddSubKeyL( listIds ); |
209 inDataKey->AddSubKeyL( listIds ); |
210 HBufC8* folderId = HnConvUtils::NumToStr8LC( aFolderId ); |
210 HBufC8* folderId = HnConvUtils::NumToStr8LC( aFolderId ); |
211 AddSubKeyL( inDataKey, KFolderId8, KKeyTypeBoolean, *folderId ); |
211 AddSubKeyL( inDataKey, KFolderId8, KKeyTypeBoolean, *folderId ); |
212 CleanupStack::PopAndDestroy( folderId ); |
212 CleanupStack::PopAndDestroy( folderId ); |
213 |
213 |
226 TLiwGenericParam itemCustomId( |
226 TLiwGenericParam itemCustomId( |
227 KItemCustomId8, TLiwVariant( static_cast<TInt32>( aId ) ) ); |
227 KItemCustomId8, TLiwVariant( static_cast<TInt32>( aId ) ) ); |
228 list->AppendL( itemCustomId ); |
228 list->AppendL( itemCustomId ); |
229 list->AppendL( command ); |
229 list->AppendL( command ); |
230 iActionRequest->HandleRequestL( *list ); |
230 iActionRequest->HandleRequestL( *list ); |
231 CleanupStack::PopAndDestroy( list ); |
231 CleanupStack::PopAndDestroy( list ); |
232 } |
232 } |
233 else |
233 else |
234 { |
234 { |
235 NotificationItemAlreadyStoredL(); |
235 NotificationItemAlreadyStoredL(); |
236 if( iOpenedHierarchy.Count() > 0 && !iLockDialog ) |
236 if( iOpenedHierarchy.Count() > 0 && !iLockDialog ) |
247 } |
247 } |
248 } |
248 } |
249 |
249 |
250 |
250 |
251 // --------------------------------------------------------------------------- |
251 // --------------------------------------------------------------------------- |
252 // |
252 // |
253 // --------------------------------------------------------------------------- |
253 // --------------------------------------------------------------------------- |
254 // |
254 // |
255 void CMmMoveToFolderCommand::SelectFolderL( |
255 void CMmMoveToFolderCommand::SelectFolderL( |
256 const RPointerArray< CMmFolder >& aFolderContent ) |
256 const RPointerArray< CMmFolder >& aFolderContent ) |
257 { |
257 { |
263 currentFolder.CreateL( |
263 currentFolder.CreateL( |
264 KFolderOpened().Length() + CurrentFolder()->Name().Length() ); |
264 KFolderOpened().Length() + CurrentFolder()->Name().Length() ); |
265 currentFolder.Append( KFolderOpened ); |
265 currentFolder.Append( KFolderOpened ); |
266 currentFolder.Append( CurrentFolder()->Name() ); |
266 currentFolder.Append( CurrentFolder()->Name() ); |
267 folders->AppendL( currentFolder ); |
267 folders->AppendL( currentFolder ); |
268 |
268 |
269 for( int i( 0 ); i<aFolderContent.Count(); i++ ) |
269 for( int i( 0 ); i<aFolderContent.Count(); i++ ) |
270 { |
270 { |
271 CMmFolder* folder = aFolderContent[ i ]; |
271 CMmFolder* folder = aFolderContent[ i ]; |
272 RBuf name; |
272 RBuf name; |
273 CleanupClosePushL( name ); |
273 CleanupClosePushL( name ); |
275 name.Append( KFolderClosed ); |
275 name.Append( KFolderClosed ); |
276 name.Append( folder->Name() ); |
276 name.Append( folder->Name() ); |
277 folders->AppendL( name ); |
277 folders->AppendL( name ); |
278 CleanupStack::PopAndDestroy( &name ); |
278 CleanupStack::PopAndDestroy( &name ); |
279 } |
279 } |
280 |
280 |
281 TInt selected( SelectFolderFromListL( |
281 TInt selected( SelectFolderFromListL( |
282 folders, CurrentFolder()->Id() == KRootId ) ); |
282 folders, CurrentFolder()->Id() == KRootId ) ); |
283 |
283 |
284 switch( selected ) |
284 switch( selected ) |
285 { |
285 { |
286 case EAknSoftkeyBack: |
286 case EAknSoftkeyBack: |
287 { |
287 { |
288 if( iOpenedHierarchy.Count() > 1 && !iLockDialog ) |
288 if( iOpenedHierarchy.Count() > 1 && !iLockDialog ) |
316 MoveToFolderL( iItemId, CurrentFolder()->Id() ); |
316 MoveToFolderL( iItemId, CurrentFolder()->Id() ); |
317 } |
317 } |
318 break; |
318 break; |
319 } |
319 } |
320 } |
320 } |
321 |
321 |
322 CleanupStack::PopAndDestroy( ¤tFolder ); |
322 CleanupStack::PopAndDestroy( ¤tFolder ); |
323 CleanupStack::PopAndDestroy( folders ); |
323 CleanupStack::PopAndDestroy( folders ); |
324 } |
324 } |
325 |
325 |
326 |
326 |
327 // --------------------------------------------------------------------------- |
327 // --------------------------------------------------------------------------- |
328 // |
328 // |
329 // --------------------------------------------------------------------------- |
329 // --------------------------------------------------------------------------- |
330 // |
330 // |
331 TInt CMmMoveToFolderCommand::SelectFolderFromListL( |
331 TInt CMmMoveToFolderCommand::SelectFolderFromListL( |
332 CDesCArrayFlat* aItems, TBool aIsRoot ) |
332 CDesCArrayFlat* aItems, TBool aIsRoot ) |
333 { |
333 { |
334 TInt selected( KErrNotFound ); |
334 TInt selected( KErrNotFound ); |
335 |
335 |
336 CAknListQueryDialog* dialog = |
336 CAknListQueryDialog* dialog = |
337 new ( ELeave ) CAknListQueryDialog( &selected ); |
337 new ( ELeave ) CAknListQueryDialog( &selected ); |
338 if( aIsRoot ) |
338 if( aIsRoot ) |
339 { |
339 { |
340 dialog->PrepareLC( R_MENU_EDIT_MOVE_TO_FOLDER_SELECT_CANCEL_QUERY ); |
340 dialog->PrepareLC( R_MENU_EDIT_MOVE_TO_FOLDER_SELECT_CANCEL_QUERY ); |
346 dialog->SetItemTextArray( aItems ); |
346 dialog->SetItemTextArray( aItems ); |
347 dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
347 dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
348 CArrayPtr<CGulIcon>* icons = GetFolderIconsL(); |
348 CArrayPtr<CGulIcon>* icons = GetFolderIconsL(); |
349 dialog->SetIconArrayL( icons ); |
349 dialog->SetIconArrayL( icons ); |
350 dialog->ListBox()->SetCurrentItemIndexAndDraw( 0 ); |
350 dialog->ListBox()->SetCurrentItemIndexAndDraw( 0 ); |
351 |
351 |
352 if( !iLockDialog ) |
352 if( !iLockDialog ) |
353 { |
353 { |
354 SetDialogL( dialog ); |
354 SetDialogL( dialog ); |
355 TInt softkey ( KErrNotFound ); |
355 TInt softkey ( KErrNotFound ); |
356 softkey = dialog->RunLD(); |
356 softkey = dialog->RunLD(); |
357 SetDialogL( NULL ); |
357 SetDialogL( NULL ); |
358 |
358 |
359 if( softkey == KSoftkeyBack ) |
359 if( softkey == KSoftkeyBack ) |
360 { |
360 { |
361 selected = EAknSoftkeyBack; |
361 selected = EAknSoftkeyBack; |
362 } |
362 } |
363 else if( selected < 0 || |
363 else if( selected < 0 || |
377 |
377 |
378 |
378 |
379 // --------------------------------------------------------------------------- |
379 // --------------------------------------------------------------------------- |
380 // Action resolving function. |
380 // Action resolving function. |
381 // --------------------------------------------------------------------------- |
381 // --------------------------------------------------------------------------- |
382 // |
382 // |
383 CArrayPtr<CGulIcon>* CMmMoveToFolderCommand::GetFolderIconsL() |
383 CArrayPtr<CGulIcon>* CMmMoveToFolderCommand::GetFolderIconsL() |
384 { |
384 { |
385 CArrayPtr<CGulIcon>* icons = new( ELeave )CAknIconArray( 10 ); |
385 CArrayPtr<CGulIcon>* icons = new( ELeave )CAknIconArray( 10 ); |
386 CleanupStack::PushL( icons ); |
386 CleanupStack::PushL( icons ); |
387 CFbsBitmap* folderClosed = NULL; |
387 CFbsBitmap* folderClosed = NULL; |
388 CFbsBitmap* folderClosedMask = NULL; |
388 CFbsBitmap* folderClosedMask = NULL; |
389 |
389 |
390 AknIconUtils::CreateIconL( folderClosed, folderClosedMask, |
390 AknIconUtils::CreateIconL( folderClosed, folderClosedMask, |
391 AknIconUtils::AvkonIconFileName(), |
391 AknIconUtils::AvkonIconFileName(), |
392 EMbmAvkonQgn_prop_folder_small, |
392 EMbmAvkonQgn_prop_folder_small, |
393 EMbmAvkonQgn_prop_folder_small_mask ); |
393 EMbmAvkonQgn_prop_folder_small_mask ); |
394 CleanupStack::PushL( folderClosed ); |
394 CleanupStack::PushL( folderClosed ); |
398 |
398 |
399 CFbsBitmap* folderOpened = NULL; |
399 CFbsBitmap* folderOpened = NULL; |
400 CFbsBitmap* folderOpenedMask = NULL; |
400 CFbsBitmap* folderOpenedMask = NULL; |
401 AknIconUtils::CreateIconL( folderOpened, folderOpenedMask, |
401 AknIconUtils::CreateIconL( folderOpened, folderOpenedMask, |
402 AknIconUtils::AvkonIconFileName(), |
402 AknIconUtils::AvkonIconFileName(), |
403 EMbmAvkonQgn_prop_folder_current, |
403 EMbmAvkonQgn_prop_folder_current, |
404 EMbmAvkonQgn_prop_folder_current_mask ); |
404 EMbmAvkonQgn_prop_folder_current_mask ); |
405 CleanupStack::PushL( folderOpened ); |
405 CleanupStack::PushL( folderOpened ); |
406 CleanupStack::PushL( folderOpenedMask ); |
406 CleanupStack::PushL( folderOpenedMask ); |
407 icons->AppendL( CGulIcon::NewL( folderOpened, folderOpenedMask ) ); |
407 icons->AppendL( CGulIcon::NewL( folderOpened, folderOpenedMask ) ); |
408 CleanupStack::Pop( 3 ); |
408 CleanupStack::Pop( 3 ); |
411 |
411 |
412 |
412 |
413 // --------------------------------------------------------------------------- |
413 // --------------------------------------------------------------------------- |
414 // Action resolving function. |
414 // Action resolving function. |
415 // --------------------------------------------------------------------------- |
415 // --------------------------------------------------------------------------- |
416 // |
416 // |
417 HBufC* CMmMoveToFolderCommand::GetFromResourceLC( TInt aIdentifier ) |
417 HBufC* CMmMoveToFolderCommand::GetFromResourceLC( TInt aIdentifier ) |
418 { |
418 { |
419 HBufC* string = StringLoader::LoadLC( aIdentifier ); |
419 HBufC* string = StringLoader::LoadLC( aIdentifier ); |
420 return string; |
420 return string; |
421 } |
421 } |
422 |
422 |
423 |
423 |
424 // --------------------------------------------------------------------------- |
424 // --------------------------------------------------------------------------- |
425 // Action resolving function. |
425 // Action resolving function. |
426 // --------------------------------------------------------------------------- |
426 // --------------------------------------------------------------------------- |
427 // |
427 // |
428 void CMmMoveToFolderCommand::NotificationMovingCompleteL() |
428 void CMmMoveToFolderCommand::NotificationMovingCompleteL() |
429 { |
429 { |
430 CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat( 1 ); |
430 CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat( 1 ); |
431 CleanupStack::PushL( items ); |
431 CleanupStack::PushL( items ); |
432 items->AppendL( iItemName ); |
432 items->AppendL( iItemName ); |
433 items->AppendL( iFolderName ); |
433 items->AppendL( iFolderName ); |
434 |
434 |
435 HBufC* msg = StringLoader::LoadLC( R_APPS_NOTE_MOVE_TO_FOLDER, *items ); |
435 HBufC* msg = StringLoader::LoadLC( R_APPS_NOTE_MOVE_TO_FOLDER, *items ); |
436 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
436 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
437 CAknNoteDialog::EConfirmationTone, |
437 CAknNoteDialog::EConfirmationTone, |
438 CAknNoteDialog::ELongTimeout ); |
438 CAknNoteDialog::ELongTimeout ); |
439 dialog->SetTextL( msg->Des() ); |
439 dialog->SetTextL( msg->Des() ); |
440 dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_COMPLETE_NOTIFICATION ); |
440 dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_COMPLETE_NOTIFICATION ); |
441 |
441 |
442 CleanupStack::PopAndDestroy( msg ); |
442 CleanupStack::PopAndDestroy( msg ); |
443 CleanupStack::PopAndDestroy( items ); |
443 CleanupStack::PopAndDestroy( items ); |
444 } |
444 } |
445 |
445 |
446 |
446 |
447 // --------------------------------------------------------------------------- |
447 // --------------------------------------------------------------------------- |
448 // Action resolving function. |
448 // Action resolving function. |
449 // --------------------------------------------------------------------------- |
449 // --------------------------------------------------------------------------- |
450 // |
450 // |
451 void CMmMoveToFolderCommand::NotificationItemAlreadyStoredL() |
451 void CMmMoveToFolderCommand::NotificationItemAlreadyStoredL() |
452 { |
452 { |
453 HBufC* message = StringLoader::LoadLC( R_APPS_NOTE_ITEM_ALREADY_STORED ); |
453 HBufC* message = StringLoader::LoadLC( R_APPS_NOTE_ITEM_ALREADY_STORED ); |
454 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
454 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
455 CAknNoteDialog::EConfirmationTone, |
455 CAknNoteDialog::EConfirmationTone, |
456 CAknNoteDialog::ELongTimeout ); |
456 CAknNoteDialog::ELongTimeout ); |
457 dialog->SetTextL( message->Des() ); |
457 dialog->SetTextL( message->Des() ); |
458 dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_ABORT_NOTIFICATION ); |
458 dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_ABORT_NOTIFICATION ); |
459 |
459 |
460 CleanupStack::PopAndDestroy( message ); |
460 CleanupStack::PopAndDestroy( message ); |
461 } |
461 } |
462 |
462 |
463 // --------------------------------------------------------------------------- |
463 // --------------------------------------------------------------------------- |
464 // |
464 // |
465 // --------------------------------------------------------------------------- |
465 // --------------------------------------------------------------------------- |
466 // |
466 // |
467 void CMmMoveToFolderCommand::StepBackInHierarchy() |
467 void CMmMoveToFolderCommand::StepBackInHierarchy() |
468 { |
468 { |
469 // Remove last folder from iOpenedHierarchy |
469 // Remove last folder from iOpenedHierarchy |
470 CMmFolder* folder = CurrentFolder(); |
470 CMmFolder* folder = CurrentFolder(); |
471 iOpenedHierarchy.Remove( iOpenedHierarchy.Count() - 1 ); |
471 iOpenedHierarchy.Remove( iOpenedHierarchy.Count() - 1 ); |
472 delete folder; |
472 delete folder; |
473 } |
473 } |
474 |
474 |
475 |
475 |
476 |
476 |
477 // --------------------------------------------------------------------------- |
477 // --------------------------------------------------------------------------- |
478 // |
478 // |
479 // --------------------------------------------------------------------------- |
479 // --------------------------------------------------------------------------- |
480 // |
480 // |
481 void CMmMoveToFolderCommand::ExecuteMoveToFolderL() |
481 void CMmMoveToFolderCommand::ExecuteMoveToFolderL() |
482 { |
482 { |
483 while (iOpenedHierarchy.Count() > 0) |
483 while (iOpenedHierarchy.Count() > 0) |
484 { |
484 { |
485 // Get folder list form MCS |
485 // Get folder list form MCS |
486 GetFolderListL( CurrentFolder()->Id() ); |
486 GetFolderListL( CurrentFolder()->Id() ); |
487 |
487 |
488 RPointerArray< CMmFolder > folders; |
488 RPointerArray< CMmFolder > folders; |
489 CleanupResetAndDestroyPushL( folders ); |
489 CleanupResetAndDestroyPushL( folders ); |
490 |
490 |
491 // Get folders from GetList output |
491 // Get folders from GetList output |
492 GetFoldersL(folders); |
492 GetFoldersL(folders); |
493 |
493 |
494 // Perform further folder selection or move operation |
494 // Perform further folder selection or move operation |
495 if( folders.Count() > 0 ) |
495 if( folders.Count() > 0 ) |
496 { |
496 { |
497 SelectFolderL( folders ); |
497 SelectFolderL( folders ); |
498 } |
498 } |
499 else |
499 else |
500 { |
500 { |
501 iFolderName.Close(); |
501 iFolderName.Close(); |
502 iFolderName.CreateL( CurrentFolder()->Name() ); |
502 iFolderName.CreateL( CurrentFolder()->Name() ); |
503 MoveToFolderL( iItemId, CurrentFolder()->Id() ); |
503 MoveToFolderL( iItemId, CurrentFolder()->Id() ); |
504 } |
504 } |
505 CleanupStack::PopAndDestroy( &folders ); |
505 CleanupStack::PopAndDestroy( &folders ); |
506 } |
506 } |
507 } |
507 } |
508 |
508 |
509 // --------------------------------------------------------------------------- |
509 // --------------------------------------------------------------------------- |
510 // |
510 // |
511 // --------------------------------------------------------------------------- |
511 // --------------------------------------------------------------------------- |
512 // |
512 // |
513 void CMmMoveToFolderCommand::GetFoldersL(RPointerArray<CMmFolder >& aFolderArray) |
513 void CMmMoveToFolderCommand::GetFoldersL(RPointerArray<CMmFolder >& aFolderArray) |
514 { |
514 { |
515 TInt pos( 0 ); |
515 TInt pos( 0 ); |
516 TInt count = iGetListOutParam->FindFirst( |
516 TInt count = iGetListOutParam->FindFirst( |
517 pos, KReturnValue8() )->Value().AsList()->Count(); |
517 pos, KReturnValue8() )->Value().AsList()->Count(); |
518 TLiwVariant var; var.PushL(); |
518 TLiwVariant var; var.PushL(); |
519 |
519 |
520 // Get propper widget names depending from view type |
520 // Get propper widget names depending from view type |
521 // and append to aFolderArray |
521 // and append to aFolderArray |
522 for( TInt i = 0; i < count; i++ ) |
522 for( TInt i = 0; i < count; i++ ) |
523 { |
523 { |
524 HnLiwUtils::GetVariantL( *iGetListOutParam, KIdPath8, i, var ); |
524 HnLiwUtils::GetVariantL( *iGetListOutParam, KIdPath8, i, var ); |
525 TInt32 id; |
525 TInt32 id; |
526 var.Get( id ); |
526 var.Get( id ); |
527 |
527 |
528 if (id != iItemId) |
528 if (id != iItemId) |
529 { |
529 { |
530 CMmFolder* folder = CMmFolder::NewL(); |
530 CMmFolder* folder = CMmFolder::NewL(); |
531 CleanupStack::PushL( folder ); |
531 CleanupStack::PushL( folder ); |
532 |
532 |
533 folder->SetId( id ); |
533 folder->SetId( id ); |
534 |
534 |
535 TPtrC title; |
535 TPtrC title; |
536 if( !iWidgetType.Compare( KWidgetTypeList ) ) |
536 if( !iWidgetType.Compare( KWidgetTypeList ) ) |
537 { |
537 { |
538 HnLiwUtils::GetVariantL( |
538 HnLiwUtils::GetVariantL( |
539 *iGetListOutParam, KLongNamePath8, i, var ); |
539 *iGetListOutParam, KLongNamePath8, i, var ); |
540 } |
540 } |
541 else if( !iWidgetType.Compare( KWidgetTypeGrid ) ) |
541 else if( !iWidgetType.Compare( KWidgetTypeGrid ) ) |
542 { |
542 { |
543 HnLiwUtils::GetVariantL( |
543 HnLiwUtils::GetVariantL( |
544 *iGetListOutParam, KShortNamePath8, i, var ); |
544 *iGetListOutParam, KShortNamePath8, i, var ); |
545 } |
545 } |
546 else |
546 else |
547 { |
547 { |
548 HnLiwUtils::GetVariantL( |
548 HnLiwUtils::GetVariantL( |
549 *iGetListOutParam, KAppGroupNamePath8, i, var ); |
549 *iGetListOutParam, KAppGroupNamePath8, i, var ); |
550 } |
550 } |
551 var.Get( title ); |
551 var.Get( title ); |
552 folder->SetNameL( title ); |
552 folder->SetNameL( title ); |
553 aFolderArray.AppendL( folder ); |
553 aFolderArray.AppendL( folder ); |
554 |
554 |
555 CleanupStack::Pop( folder ); |
555 CleanupStack::Pop( folder ); |
556 } |
556 } |
557 } |
557 } |
558 CleanupStack::PopAndDestroy(&var); |
558 CleanupStack::PopAndDestroy(&var); |
559 } |
559 } |
560 |
560 |
561 // --------------------------------------------------------------------------- |
561 // --------------------------------------------------------------------------- |
562 // Symbian factory function. |
562 // Symbian factory function. |
563 // --------------------------------------------------------------------------- |
563 // --------------------------------------------------------------------------- |
564 // |
564 // |
587 { |
587 { |
588 iName.Close(); |
588 iName.Close(); |
589 } |
589 } |
590 |
590 |
591 // --------------------------------------------------------------------------- |
591 // --------------------------------------------------------------------------- |
592 // |
592 // |
593 // --------------------------------------------------------------------------- |
593 // --------------------------------------------------------------------------- |
594 // |
594 // |
595 CMmFolder::CMmFolder() |
595 CMmFolder::CMmFolder() |
596 { |
596 { |
597 } |
597 } |
598 |
598 |
599 // --------------------------------------------------------------------------- |
599 // --------------------------------------------------------------------------- |
600 // |
600 // |
601 // --------------------------------------------------------------------------- |
601 // --------------------------------------------------------------------------- |
602 // |
602 // |
603 void CMmFolder::SetNameL( const TDesC& aName ) |
603 void CMmFolder::SetNameL( const TDesC& aName ) |
604 { |
604 { |
605 iName.Close(); |
605 iName.Close(); |
606 iName.CreateL( aName ); |
606 iName.CreateL( aName ); |
607 } |
607 } |
608 |
608 |
609 // --------------------------------------------------------------------------- |
609 // --------------------------------------------------------------------------- |
610 // |
610 // |
611 // --------------------------------------------------------------------------- |
611 // --------------------------------------------------------------------------- |
612 // |
612 // |
613 const TDesC& CMmFolder::Name() const |
613 const TDesC& CMmFolder::Name() const |
614 { |
614 { |
615 return iName; |
615 return iName; |
616 } |
616 } |
617 |
617 |
618 // --------------------------------------------------------------------------- |
618 // --------------------------------------------------------------------------- |
619 // |
619 // |
620 // --------------------------------------------------------------------------- |
620 // --------------------------------------------------------------------------- |
621 // |
621 // |
622 void CMmFolder::SetId( TInt aId ) |
622 void CMmFolder::SetId( TInt aId ) |
623 { |
623 { |
624 iId = aId; |
624 iId = aId; |
625 } |
625 } |
626 |
626 |
627 // --------------------------------------------------------------------------- |
627 // --------------------------------------------------------------------------- |
628 // |
628 // |
629 // --------------------------------------------------------------------------- |
629 // --------------------------------------------------------------------------- |
630 // |
630 // |
631 TInt CMmFolder::Id() |
631 TInt CMmFolder::Id() |
632 { |
632 { |
633 return iId; |
633 return iId; |
634 } |
634 } |
635 |
635 |
636 // end of file |
636 // end of file |
637 |
637 |